Пример #1
0
        public GridGeneratorTests()
        {
            PlayerStats   playerStats   = new PlayerStats();
            ConsoleHelper consoleHelper = ConsoleHelper.Instance(playerStats);

            ISegmentation segmentation = Segmentation.Instance();

            shipRandomiser = ShipRandomiser.Instance();

            gridGenerator = new GridGenerator(segmentation, shipRandomiser, consoleHelper, new List <IShip>());
        }
Пример #2
0
        public static GridGenerator Instance()
        {
            if (instance == null)
            {
                lock (SyncObject)
                {
                    if (instance == null)
                    {
                        ISegmentation   segmentation   = Segmentation.Instance();
                        IShipRandomiser shipRandomiser = ShipRandomiser.Instance();
                        List <IShip>    ships          = new List <IShip>();
                        instance = new GridGenerator(segmentation, shipRandomiser, ships);
                    }
                }
            }

            return(instance);
        }
Пример #3
0
        public Program()
        {
            // Game play objects
            List <IShip> ships = new List <IShip> {
                new BattleShip(1), new Destroyer(2), new Destroyer(3)
            };

            playerStats = new PlayerStats();

            // Not using a IoC framework (manual singletons), so it will just get new up a instance here,
            // and injected directly. Once we go out of scope here, allow the GC to clean up behind us
            ISegmentation   segmentation   = Segmentation.Instance();
            IShipRandomiser shipRandomiser = ShipRandomiser.Instance();

            consoleHelper = ConsoleHelper.Instance(playerStats);

            gridGenerator = new GridGenerator(segmentation, shipRandomiser, consoleHelper, ships);

            shipCounter = ships.Count;
            message     = consoleHelper.StartGameMessage;
        }
Пример #4
0
 public SegmentationTests()
 {
     shipRandomiser = ShipRandomiser.Instance();
     segmentation   = Segmentation.Instance();
 }
Пример #5
0
 protected GamePlayer()
 {
     this.shipRandomiser = ShipRandomiser.Instance();
     this.gameRepository = GameRepository.Instance();
 }
Пример #6
0
 public ShipRandomiserTests()
 {
     shipRandomiser = ShipRandomiser.Instance();
 }
Пример #7
0
 public GridGeneratorTests()
 {
     shipRandomiser = ShipRandomiser.Instance();
     gridGenerator  = GridGenerator.Instance();
 }