Exemple #1
0
 public override void Update(EnemyAgent agent)
 {
     if (agent.GetCurrentTimeBtwAttacks() <= 0)
     {
         agent.Attack();
     }
     else
     {
         agent.AdjustAttackTime();
     }
 }
 public override void Update(EnemyAgent agent)
 {
     //check if target still in attack range if yes attack again after ending the attack animation
     agent.SetPlayerTarget();
     if (Vector3.Distance(agent.GetNavMeshAgent().destination, agent.transform.position) < agent.GetAttackRange())
     {
         if (agent.GetCurrentTimeBtwAttacks() <= 0)
         {
             agent.Attack();
         }
         else
         {
             agent.AdjustAttackTime();
         }
     }
     else
     {
         agent.SetState(FollowPlayerState.GetInstance());
     }
 }