public void OnReleased(MouseReleasedEvent e) { dragging = false; if (Collisions.CheckCollisions(game.RPlayer.MapDimension, NewDimension)) { int TestX = NewDimension.X; int TestY = NewDimension.Y; RenderInfo.CalculateCoord(ref TestX, ref TestY, game.RPlayer); ship = FabricShips.GetShip(LenghtShips[currentPointer], shipType, TestX, TestY); bool NextShip = game.Player.PushShip(ship); if (NextShip) { ++currentPointer; if (currentPointer > 9) { NextState(game.WarState); } else { ResizeShip(); } } } else { RelocationShip(); } }
public void OnPressed(MousePressedEvent e) { if (e.Buttons == System.Windows.Forms.MouseButtons.Right) { shipType = (shipType == ShipType.HORIZONTAL) ? ShipType.VERTICAL : ShipType.HORIZONTAL; Dimension.Swap(ref NewDimension.Width, ref NewDimension.Height); Dimension.Swap(ref StartDimension.Width, ref StartDimension.Height); } dragging = Collisions.Contains(new Point(e.X, e.Y), NewDimension); }
public void OnPressed(MousePressedEvent e) { if (Collisions.Contains(new Point(e.X, e.Y), game.RBot.MapDimension)) { int TestX = e.X; int TestY = e.Y; RenderInfo.CalculateCoord(ref TestX, ref TestY, game.RBot); bool EndGame = dispatcherShots.DispatchShots(TestX, TestY); if (EndGame) { NextState(game.FinishGame); } } }