Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (health.IsDead())
     {
         return;
     }
     //chase and attack
     if (DistanceToPlayer() < chaseDistance && fighter.ShouldAttack(player))
     {
         timeFromLastSaw = 0;
         fighter.Attack(player);
     }
     // suspious
     else if (timeFromLastSaw < suspicionTime)
     {
         SuspiousState();
     }
     // back to patrol
     else
     {
         PatrolState();
     }
     timeFromLastSaw            += Time.deltaTime;
     timeFromDwellAtPatrolPoint += Time.deltaTime;
 }