Example #1
0
        private void ExecuteStandardMovement(Ship ship)
        {
            var newCoodinate = ship.Position.Hex.Neighbor(ship.Position.Rotation);

            ship.Position = ship.Position.WithHex(newCoodinate);

            var turnMarkersToDecrement = MovementMarkers.Where(x => x.ForShipId == ship.ShipId).ToList();

            foreach (var turnMarker in turnMarkersToDecrement)
            {
                turnMarker.Decrement();
            }
        }
Example #2
0
        private void ExecuteSideSlip(Ship ship, int direction)
        {
            MovementMarkers.Add(new SideSlipMarker
            {
                Position  = ship.Position,
                Remaining = 1,
                ForShipId = ship.ShipId
            });

            var newCoodinate = ship.Position.Hex.Neighbor(direction);

            ship.Position = ship.Position.WithHex(newCoodinate);
        }
Example #3
0
 private void ExecutePlottedNavigation(Ship ship, DeclaredNavigation declaredNavigation)
 {
     if (declaredNavigation.SideSlipDirection.HasValue)
     {
         ExecuteSideSlip(ship, declaredNavigation.SideSlipDirection.Value);
     }
     else
     {
         if (declaredNavigation.NewFacing.HasValue)
         {
             ship.Position = ship.Position.WithFacing(declaredNavigation.NewFacing.Value);
             MovementMarkers.Add(new TurnMarker
             {
                 ForShipId = ship.ShipId,
                 Remaining = ship.CurrentSpeed,
                 Position  = ship.Position
             });
         }
         ExecuteStandardMovement(ship);
     }
 }