Add damage system and processing system to enemy

This commit is contained in:
2024-08-10 17:46:57 +02:00
parent f3623c6036
commit 6e0802163e
24 changed files with 1112 additions and 115 deletions

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class ProcessHitComponent : MonoBehaviour
{
private HashSet<GameObject> ignored = new HashSet<GameObject>();
public UnityEvent<int> onTakeDamage;
public void Process(OnHitEvent.Args args)
{
var source = args.source;
if (ignored.Contains(source)) return;
Debug.Log("Got hit");
onTakeDamage.Invoke(args.damage.value);
ignored.Add(args.source);
}
}