Esempio n. 1
0
    void Updating()
    {
        /*if (!soundsStarted)
         * {
         *  soundsStarted = true;
         *  enemy.PlaySound(enemy.enemyAudio, enemy.patrolSound);
         *  enemy.enemyAudio.loop = true;
         * }*/
        //randomly move around
        if (enemy.GetPriorityPatrol())
        {
            enemy.PriorityPatrol();
        }
        else
        {
            enemy.Patrol();
        }

        //TRANSITIONS GO HERE
        if ((enemy.PlayerDetected() || enemy.PlayerInFieldOfView()))
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("investigate", true);
            ToInvestigateState();
        }
        else if (enemy.PlayerIsAttacking() && enemy.WillAttemptToCounter() && enemy.PlayerIsWithinStrikingDistance() && enemy.PlayerInFieldOfView())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("block", true);
            ToBlockSwordState();
        }
        else
        {
            ToPatrolState();
        }
    }