Example #1
0
    private void Update()
    {
        if (healthyState == HealthyState.Healthy)
        {
            if (Time.time - bleedTimer < bleedRecover)
            {
                life -= bleedDPS;
                if (life < 0)
                {
                    ToStaggerState();
                }
            }

            if (monsterBehavior != null)
            {
                monsterBehavior.RunBehavior();
            }
        }
        else if (healthyState == HealthyState.Staggered)
        {
            if (Time.time - staggerTime > staggerRecovery)
            {
                ToLastStand();
            }
        }
        else if (healthyState == HealthyState.LastStand)
        {
            if (monsterBehavior != null)
            {
                monsterBehavior.RunBehavior();
            }
        }

        if (healthyState == HealthyState.Dead)
        {
            GameObject.Destroy(gameObject);
        }
    }