Exemplo n.º 1
0
        private void OnTriggerEnter(Collider other)
        {
            if (!other.CompareTag("Enemy"))
            {
                return;
            }

            OnDeathPlayer?.Invoke(other);
        }
Exemplo n.º 2
0
    public void DealDamage(CreatureStats from, CreatureStats to, int number, IDamage damage = null)
    {
        if (damage == null)
        {
            damage = new BaseDamage();
        }

        int realDamage = damage.GetCalculate(to, number);

        to.HP -= realDamage;

        if (to.HP <= 0)
        {
            OnDeathPlayer?.Invoke(to, damage);
        }
        Debug.LogFormat("{0} наносит {1} урон {2}", from.name, realDamage, to.name);
        OnDealDamage?.Invoke(to, damage);
    }