示例#1
0
 public override void OnStateEnter(AIState previousState, AIState newState)
 {
     if (pathway == null)
     {
         pathway = FindObjectOfType <Pathway>();
         Debug.Assert(pathway, "Have no Pathway");
     }
     if (destination == null)
     {
         //获取下一个节点
         destination = pathway.GetNearestWayPoint(transform.position);
     }
     navAgent.destination = destination.transform.position;
     navAgent.move        = true;
     navAgent.turn        = true;
     if (_animator != null)
     {
         _animator.SetTrigger("move");
     }
 }