UnityEngine.AI.NavMeshAgent.Stop C# (CSharp) Method

Stop() public method

Stop movement of this agent along its current path.

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

Same methods

NavMeshAgent::Stop ( bool stopUpdates ) : void

Usage Example

Exemplo n.º 1
0
    //------------------------------------------
    public IEnumerator AIPatrol()
    {
        //Loop while patrolling
        while (currentstate == ENEMY_STATE.PATROL)
        {
            //Set strict search
            ThisLineSight.Sensitity = LineSight.SightSensitivity.STRICT;

            //Chase to patrol position
            ThisAgent.Resume();
            ThisAgent.SetDestination(PatrolDestination.position);

            //Wait until path is computed
            while (ThisAgent.pathPending)
            {
                yield return(null);
            }

            //If we can see the target then start chasing
            if (ThisLineSight.CanSeeTarget)
            {
                ThisAgent.Stop();
                CurrentState = ENEMY_STATE.CHASE;
                yield break;
            }

            //Wait until next frame
            yield return(null);
        }
    }
All Usage Examples Of UnityEngine.AI.NavMeshAgent::Stop