protected override System.Threading.Tasks.Task OnReceivedAsync(string clientId, string data) { int colourIndex = Game.NumberOfShips; if ( Game.NumberOfShips > _colours.Length - 1 ) colourIndex = Game.NumberOfShips % _colours.Length; var colour = _colours[colourIndex]; var ship = new Ship() {Colour = colour, Name = data, X = 50, Y = 50}; Game.AddGameShip(ship); return Connection.Broadcast(ship); }
public static void AddGameShip(Ship ship) { _game.AddShip(ship); }
public void AddShip(Ship ship) { _ships.Add(ship); }
private void MoveShip(Ship ship) { ship.Move(); ship.MoveMissiles(); ship.Decelerate(); }