Exemplo n.º 1
0
        public ShipPlacements PlaceShip(ShipCoordinates request)
        {
            if (_currentShipIndex > 4)
            {
                throw new Exception("You can not add another ship, 5 is the limit!");
            }

            if (!IsValidCoordinate(request.Coordinate))
            {
                return(ShipPlacements.NotEnoughSpace);
            }

            Ship newShip = CreateShip.CreateShips(request.ShipType);

            switch (request.Direction)
            {
            case ShipDirections.Down:
                return(PlaceShipDown(request.Coordinate, newShip));

            case ShipDirections.Up:
                return(PlaceShipUp(request.Coordinate, newShip));

            case ShipDirections.Left:
                return(PlaceShipLeft(request.Coordinate, newShip));

            default:
                return(PlaceShipRight(request.Coordinate, newShip));
            }
        }
Exemplo n.º 2
0
 protected Player(ShipType type)
 {
     this.InputManagerInstance = new InputManager();
     this.Ship = CreateShip.Create(type);
 }