25 lines
525 B
C#
25 lines
525 B
C#
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);
|
|
}
|
|
}
|