Example #1
0
    public virtual void TakeHit(Damage damage)
    {
        if (IsDie)
        {
            return;
        }

        if (immortal)
        {
            return;
        }

        damage.Active();

        SecuredDouble hit = damage.value;

        CurrentHp -= hit;
        if (CurrentHp <= 0)
        {
            CurrentHp = 0;
            Die();
        }

        if (OnTakeHit != null)
        {
            OnTakeHit.Invoke(damage);
        }
    }