Пример #1
0
    public void TakeDamage(CharacterStat from, float damage)
    {
        _hp = Mathf.Clamp(_hp - damage, 0, _maxHp);
        if (_hp <= 0)
        {
            if (lastHitBy == null)
            {
                lastHitBy = from;
            }

            GetComponent <FSMManager>().SetDeadState();
            from.GetComponent <FSMManager>().NotifyTargetKilled();
        }
    }
Пример #2
0
    public void TakeDamage(CharacterStat from, float damage)
    {
        _hp = Mathf.Clamp(_hp - damage, 0, playerStat.maxHp);
        if (_hp <= 0)
        {
            if (lastHitBy == null)
            {
                lastHitBy = from;
            }

            GetComponent <IFSMManager>().SetDeadState();
            from.GetComponent <IFSMManager>().NotifyTargetKilled();
            Debug.Log(name + " is Killed by " + lastHitBy.name);
        }
    }