Beispiel #1
0
 private void Move()
 {
     if (waypointindex <= waypoints.Count - 1)
     {
         var targetPosition    = waypoints[waypointindex].transform.position;
         var movementThisFrame = waveConfig.GetMooveSpeed() * Time.deltaTime;
         transform.position = Vector2.MoveTowards
                                  (transform.position, targetPosition, movementThisFrame);
         if (transform.position == targetPosition)
         {
             waypointindex++;
         }
     }
     else
     {
         Destroy(gameObject);
     }
 }