Ejemplo n.º 1
0
    public override AIState doTransition( )
    {
        if (health && playerHealth)
        {
            if (health.CurrentHealth <= 0.0f)
            {
                return(AIState.death);
            }
            if (playerHealth.CurrentHealth <= 0.0f)
            {
                return(AIState.win);
            }

            if (health.CurrentHealth < nextPhaseHealthLevel && health.CurrentHealth > 0.0f)
            {
                anim.swimAnim();
                movement.EndOnTopRow();
                return(AIState.phase3);
            }
            else
            {
                return(AIState.phase2);
            }
        }
        else
        {
            health = this.gameObject.GetComponent <Health>();
            GameObject obj = GameObject.FindGameObjectWithTag("Player");
            if (obj)
            {
                playerHealth = obj.GetComponent <Health>();
            }
            return(AIState.phase2);            // return to self
        }
    }