Exemplo n.º 1
0
 //sets the current waypoint we are starting at
 public void setCurrentWaypoint(TravelWaypoint current)
 {
     if(currentWaypoint != null)
         currentWaypoint.active = false;
     currentWaypoint = current;
     currentWaypoint.active = true;
     targetWaypoint = currentWaypoint.next;
 }
Exemplo n.º 2
0
 void moveTowardsWaypoint()
 {
     transform.position = Vector2.MoveTowards(transform.position, targetWaypoint.transform.position, movementSpeed * Time.deltaTime);
     if (Vector2.Distance(transform.position, targetWaypoint.transform.position) < .2f)
     {
         targetWaypoint = targetWaypoint.next;
         if (targetWaypoint == null)
         {
             playerWon();
         }
     }
 }