コード例 #1
0
        public GameSession Initialization(string map = "Map_004")
        {
            _gameSession = ScenarioConvertor.ToGameSession(ScenarioConvertor.GetSavedMap(map));

            _gameSession.Commands = new List <Command>();

            return(_gameSession);
        }
コード例 #2
0
        public void GetPlayerSpaceShipTest()
        {
            var gameSession = ScenarioConvertor.ToGameSession(ScenarioConvertor.GetSavedMap("PlayerSpaceShipTest"));

            Assert.AreEqual("HMS Glowworm", gameSession.GetPlayerSpaceShip().Name);
            Assert.AreEqual(90, gameSession.GetPlayerSpaceShip().Direction);
            Assert.AreEqual(10000, gameSession.GetPlayerSpaceShip().PositionX);
            Assert.AreEqual(10000, gameSession.GetPlayerSpaceShip().PositionY);

            var spaceShip = (Spaceship)gameSession.GetPlayerSpaceShip();

            Assert.AreEqual(8, spaceShip.Modules.Count);

            Assert.AreEqual(1, spaceShip.GetModules(Category.DeepScanner).Count);
            Assert.AreEqual(1, spaceShip.GetModules(Category.SpaceScanner).Count);
            Assert.AreEqual(2, spaceShip.GetModules(Category.Shield).Count);
            Assert.AreEqual(2, spaceShip.GetModules(Category.Reactor).Count);
            Assert.AreEqual(1, spaceShip.GetModules(Category.Weapon).Count);

            var deepScanners = spaceShip.GetModules(Category.DeepScanner);

            Assert.AreEqual(2, deepScanners[0].Compartment);
            Assert.AreEqual(2, deepScanners[0].Slot);

            var spaceScanners = spaceShip.GetModules(Category.SpaceScanner);

            Assert.AreEqual(2, spaceScanners[0].Compartment);
            Assert.AreEqual(1, spaceScanners[0].Slot);

            var compartmentModules = spaceShip.GetModules(2);

            Assert.AreEqual(2, compartmentModules.Count);
            Assert.AreEqual(2, compartmentModules[0].Compartment);
            Assert.AreEqual(1, compartmentModules[0].Slot);
            Assert.AreEqual(2, compartmentModules[1].Compartment);
            Assert.AreEqual(2, compartmentModules[1].Slot);
        }
コード例 #3
0
        public GameSession Initialization()
        {
            _gameSession = ScenarioConvertor.ToGameSession(ScenarioConvertor.GetSavedMap("Map_003"));

            return(_gameSession);
        }