public virtual void Jump(float duration) { if (jumpButton) { return; } jumpButton = true; if (navMeshAgent == null) { navMeshAgent = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); } // off while we jump navMeshAgent.StopAgent(); jumping = true; jumpingReachedApex = false; lastJumpTime = Time.time; lastJumpStartHeight = transform.position.y; touchWallJumpTime = -1; lastJumpButtonTime = -10; CancelInvoke("JumpStop"); Invoke("JumpStop", duration); }
public virtual void StopAgent() { if (agent != null) { agentState = GamePlayerNavMeshAgentState.STOP; agent.destination = gameObject.transform.position; agent.StopAgent(); } }