Beispiel #1
0
    public void OnHurt(float damage)
    {
        if (healthyState == HealthyState.LastStand)
        {
            ToDeadState();
        }
        else if (healthyState == HealthyState.Healthy)
        {
            if (monsterBehavior != null)
            {
                if (!monsterBehavior.IsAware)
                {
                    monsterBehavior.BecomeAware();
                }
            }

            life -= damage * Defense;
            Debug.Log($"Total damage done {damage * Defense}");
            bleedTimer = Time.time;

            if (life < 0)
            {
                ToStaggerState();
            }
        }
        else if (healthyState == HealthyState.Staggered)
        {
            staggeredLife += Time.deltaTime;
            if (staggeredLife > staggerShotCap)
            {
                ToDeadState();
            }
        }
    }