public virtual void OnDeath(int pDamage = 0, BaseActor pKiller = null) { whoHit.Clear(); isAlive = false; if(onDeathCallback != null) onDeathCallback(this); onDeathCallback = null; }
// Metodo para recebicao de Dano public virtual void ReceiveDamage(int pDamage, BaseActor pBully) { if(!whoHit.Contains(pBully)){ onDeathCallback += pBully.OnMurder; whoHit.Add(pBully); } currentLife -= pDamage; if(currentLife <= 0) OnDeath(); }
void Awake() { _controller = GetComponent <PlayerController>(); onDeathDelegate += OnDeath; }