示例#1
0
 public override IEnumerator bootCoroutine(NPCController controller)
 {
     while (true)
     {
         yield return(WalkAround(controller, controller.Agent));
     }
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     controller  = GetComponent <NPCController>();
     agent       = GetComponent <NavMeshAgent>();
     agent.speed = speed;
     //agent.SetDestination(waypoints[destinationPoint].position);
 }
示例#3
0
        protected IEnumerator WalkAround(NPCController controller, NavMeshAgent agent)
        {
            int destinationPoint = 0;

            controller = GetComponent <NPCController>();
            //Circuit circuit = controller.GetComponent<Circuit>();
            agent = GetComponent <NavMeshAgent>();
            // Maybe, an IF instead of a while?
            List <Transform> waypoints = controller.GetComponent <Circuit>().Waypoints;

            if (waypoints == null || waypoints.Count == 0)
            {
                yield return(null);
            }
            else if (Vector3.Distance(waypoints[destinationPoint].position, transform.position) < 1)
            {
                destinationPoint = (destinationPoint + 1) % waypoints.Count;
                agent.SetDestination(waypoints[destinationPoint].position);
            }
            yield return(null);
        }
示例#4
0
 // Function to be Overrided on children
 public virtual IEnumerator bootCoroutine(NPCController controller)
 {
     yield return(null);
 }