Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public static void AddGameShip(Ship ship)
 {
     _game.AddShip(ship);
 }
Esempio n. 3
0
 public void AddShip(Ship ship)
 {
     _ships.Add(ship);
 }
Esempio n. 4
0
 private void MoveShip(Ship ship)
 {
     ship.Move();
     ship.MoveMissiles();
     ship.Decelerate();
 }