public void ToPatrolState()
 {
     enemy.SetPriorityPatrol(true);
     enemy.PriorityPatrolSetup();
     soundStarted       = false;
     enemy.currentState = enemy.patrolState;
 }
Exemple #2
0
    void Updating()
    {
        if (!soundsStarted)
        {
            soundsStarted = true;
            StartCoroutine("ChaseSound");
        }
        enemy.ChasePlayer();

        if (enemy.gameObject.name == "Enemy (1)")
        {
            Debug.Log("this should be called");
        }

        //TRANSITIONS GO HERE
        if (!enemy.PlayerDetected() && !enemy.PlayerInFieldOfView())
        {
            enemy.SetPriorityPatrol(true);
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("patrol", true);
            ToPatrolState();
        }
        else if (enemy.EnemyIsTooClose())
        {
            GetComponent <Rigidbody>().AddForce(-transform.forward * 5, ForceMode.Impulse);
        }
        else if (enemy.EnemyIsWithinAllowableBounds() && enemy.PlayerInFieldOfView())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("engarde", true);
            ToEngardeState();
        }
        else
        {
            ToChaseState();
        }
    }