Пример #1
0
 // after reached destination check if the plane is outsite the map
 private void CheckBorders()
 {
     if (planeTransform.position.z >= borders.y)
     {
         if (isStartingPlane && destinationDir == Destination.NORTH)
         {
             planeMan.PlaneReachedDestination(this, fieldsMovement);
         }
         else
         {
             planeMan.OutOfMap(this, fieldsMovement);
         }
         StartCoroutine(FlyAwayAnimation());
     }
     else if (planeTransform.position.x >= borders.z)
     {
         if (isStartingPlane && destinationDir == Destination.EAST)
         {
             planeMan.PlaneReachedDestination(this, fieldsMovement);
         }
         else
         {
             planeMan.OutOfMap(this, fieldsMovement);
         }
         StartCoroutine(FlyAwayAnimation());
     }
     else if (planeTransform.position.z <= borders.w)
     {
         if (isStartingPlane && destinationDir == Destination.SOUTH)
         {
             planeMan.PlaneReachedDestination(this, fieldsMovement);
         }
         else
         {
             planeMan.OutOfMap(this, fieldsMovement);
         }
         StartCoroutine(FlyAwayAnimation());
     }
     else if (planeTransform.position.x <= borders.x)
     {
         if (isStartingPlane && destinationDir == Destination.WEST)
         {
             planeMan.PlaneReachedDestination(this, fieldsMovement);
         }
         else
         {
             planeMan.OutOfMap(this, fieldsMovement);
         }
         StartCoroutine(FlyAwayAnimation());
     }
     else
     {
         notInteractable = false;
     }
     SetRotationFeedback(false);
 }