UnityEngine.NavMeshAgent.Stop C# (CSharp) Method

Stop() public method

public Stop ( ) : void
return void
        public void Stop()
        {
            this.StopInternal();
        }

Same methods

NavMeshAgent::Stop ( bool stopUpdates ) : void

Usage Example

コード例 #1
0
    void Update()
    {
        player = sCharactersManager.characters[0].gameObject;
        agent = GetComponent<NavMeshAgent>();
        if(!gameObject.GetComponent<Character>().isDead)
        {
            if(agent.isOnNavMesh)
            {
                agent.SetDestination(player.transform.position);
                if(Vector3.Distance(player.transform.position,transform.position) > 1.5f)
                {
                    agent.Resume();
                }else{
                    agent.Stop();
                }
            }

            if(Vector3.Distance(player.transform.position,transform.position) < 5)
            {
                Vector3 lookPos = new Vector3(player.transform.position.x, gameObject.transform.position.y, player.transform.position.z);
                gameObject.transform.LookAt(lookPos);
            }
        }else{
            agent.Stop();
        }
    }
All Usage Examples Of UnityEngine.NavMeshAgent::Stop