public override void Execute(FSMBehaviour fsm) { NavMeshAgentFSM fsmn = (NavMeshAgentFSM)fsm; fsmn.navMeshAgent.isStopped = true; fsmn.navMeshAgent.ResetPath(); fsmn.navMeshAgent.velocity = Vector3.zero; if (fsmn.rigidBody.isKinematic == false) { fsmn.rigidBody.velocity = Vector3.zero; } }
private bool CheckDecision(NavMeshAgentFSM fsm) { NavMeshAgent agent = fsm.navMeshAgent; if (agent.remainingDistance <= agent.stoppingDistance + fsm.agentStats.agent.pathEndThreshold) { if (agent.pathPending == false) { //agent.isStopped = true; return(true); } } return(false); }
private void DoExecute(NavMeshAgentFSM fsm) { if (Application.isEditor && Application.isPlaying == false) { return; } NavMeshAgent agent = fsm.navMeshAgent; FSMTargetBehaviour target = TargetGo; AIAgentStats agentStats = fsm.agentStats; if (TargetGo == null) { agent.ResetPath(); agent.isStopped = true; return; } Transform chase = null; chase = target.transform; agent.destination = chase.position; agent.isStopped = false; if (agent.remainingDistance <= agent.stoppingDistance + agentStats.agent.pathEndThreshold) { if (agent.pathPending == false) { // agent.ResetPath(); agent.isStopped = true; } } }