Esempio n. 1
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Enemy"))
     {
         enemy.GetComponent <NavMeshAgent>().Stop();
     }
 }
Esempio n. 2
0
    private void Search()
    {
        if (enemy.navMeshAgent.remainingDistance < 1f)
        {
            enemy.navMeshAgent.Stop();
            if (enemy.GetComponent <Animator>() != null)
            {
                enemy.GetComponent <Animator>().SetFloat("BlendSpeed", -1);
            }

            enemy.transform.Rotate(0, enemy.searchingTurnSpeed * Time.deltaTime, 0);
            searchTimer += Time.deltaTime;

            if (searchTimer >= enemy.searchingDuration)
            {
                enemy.viewCone.setAlarmed(false, 0);
                ToPatrolState();
            }
        }
    }
Esempio n. 3
0
 public void ToPatrolState()
 {
     enemy.GetComponent <Animator>().SetBool("isMoving", true);
     enemy.GetComponent <Animator>().SetBool("isRunning", false);
     enemy.currentState = enemy.patrolState;
     searchTimer        = 0f;
 }
Esempio n. 4
0
 public void ToChaseState()
 {
     enemy.GetComponent <Animator>().SetBool("isMoving", false);
     enemy.GetComponent <Animator>().SetBool("isRunning", true);
     enemy.currentState = enemy.chaseState;
 }