예제 #1
0
 private void Move()
 {
     if (_wayPointIndex <= _wayPoints.Count - 1)
     {
         var targetPosition    = _wayPoints[_wayPointIndex].transform.position;
         var movementThisFrame = _waveConfig.GetMovesSpeed() * Time.deltaTime;
         transform.position = Vector2.MoveTowards(transform.position, targetPosition, movementThisFrame);
         if (transform.position == targetPosition)
         {
             _wayPointIndex++;
         }
     }
     else
     {
         Destroy(gameObject);
     }
 }