summaryrefslogtreecommitdiff
path: root/GameCode/DealtDamageTrigger.cs
blob: d596b4d4ce788487a2f05d70305da5fe90139e55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using UnityEngine;
using UnityEngine.Events;

public class DealtDamageTrigger : MonoBehaviour
{
	public UnityEvent triggerEvent;

	private void Start()
	{
		CharacterStatModifiers stats = GetComponentInParent<Player>().data.stats;
		stats.DealtDamageAction = (Action<Vector2, bool>)Delegate.Combine(stats.DealtDamageAction, new Action<Vector2, bool>(DealtDamage));
	}

	private void DealtDamage(Vector2 dmg, bool lethal)
	{
		triggerEvent.Invoke();
	}
}