public override void Enter(EnemyAgent agent) { agent.SetAnimation(true); agent.GetNavMeshAgent().isStopped = true; agent.ResetAttack(); //start attack animation agent.Attack(); }
public override void Enter(EnemyAgent agent) { agent.GetRigidbody().velocity = Vector3.zero; agent.GetNavMeshAgent().isStopped = true; agent.SetAnimation(true); agent.ResetAttack(); //start attack animation agent.Attack(); }
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()); } }