コード例 #1
0
        public void TestPathBetweenStartingSectors_DoubleRing4()
        {
            var target = GameMaps.LoadMap(_game, "DoubleRing4");

            target.SetVisibilityToTeam(1, true);

            var start = target.Sectors.First(_ => _.StartingSector != 0);
            var mid2  = target.Sectors.Where(_ => _.StartingSector != 0).Skip(1).First();
            var mid3  = target.Sectors.Where(_ => _.StartingSector != 0).Skip(2).First();
            var end   = target.Sectors.Last(_ => _.StartingSector != 0);

            var path1 = target.ShortestPath(1, start.Id, end.Id);

            path1.ShouldNotBeNull();
            path1.Count.ShouldBe(1);

            var path2 = target.ShortestPath(1, start.Id, mid2.Id);

            path2.ShouldNotBeNull();
            path2.Count.ShouldBe(1);

            var path3 = target.ShortestPath(1, start.Id, mid3.Id);

            path3.ShouldNotBeNull();
            path3.Count.ShouldBe(2);
        }
コード例 #2
0
 public void Setup()
 {
     _game = new StrategyGame();
     _game.SetupGame(GameSettings.Default());
     _game.LoadData();
     _game.Map = GameMaps.LoadMap(_game, "PinWheel2");
 }
コード例 #3
0
 private void LoadSettings()
 {
     _game.SetupGame(_settings);
     _game.LoadData();
     _game.Map = GameMaps.LoadMap(_game, _settings.MapName);
     _game.InitialiseGame(false);
 }
コード例 #4
0
        public void Setup()
        {
            _game = new StrategyGame();

            _game.SetupGame(GameSettings.Default());
            _target = GameMaps.LoadMap(_game, "PinWheel2");
            _target.SetVisibilityToTeam(1, true);
        }
コード例 #5
0
        public void Setup()
        {
            _settings = GameSettings.Default();
            _game     = new StrategyGame();

            _game.SetupGame(_settings);
            _game.LoadData();
            _game.Map = GameMaps.LoadMap(_game, _settings.MapName);
        }
コード例 #6
0
        public void Setup()
        {
            _game = new StrategyGame();

            _game.SetupGame(GameSettings.Default());
            _game.LoadData();
            _game.Map = GameMaps.LoadMap(_game, "PinWheel2");

            _target = new CommanderAI(_game, 2, Color.Red, null);
        }
コード例 #7
0
        public void Setup()
        {
            var settings = GameSettings.Default();

            _game = new StrategyGame();
            _game.SetupGame(settings);
            _game.LoadData();
            _game.Map = GameMaps.LoadMap(_game, settings.MapName);
            _game.InitialiseGame();
        }
コード例 #8
0
        public void TestNextWormholesWhenNotVisible()
        {
            _game.Map = GameMaps.LoadMap(_game, "Star2");

            GameEntity otherEnd;
            var        next = _game.NextWormholeEnd(1, 1, 4, out otherEnd);

            next.ShouldBeNull();
            otherEnd.ShouldBeNull();
        }
コード例 #9
0
        public void TestPathBetweenStartingSectors_DoubleRing()
        {
            var target = GameMaps.LoadMap(_game, "DoubleRing2");

            target.SetVisibilityToTeam(1, true);

            var start = target.Sectors.First(_ => _.StartingSector != 0);
            var end   = target.Sectors.Last(_ => _.StartingSector != 0);

            var path = target.ShortestPath(1, start.Id, end.Id);

            path.ShouldNotBeNull();
            path.Count.ShouldBe(1);
        }
コード例 #10
0
        public void TestNextWormholeBetweenStartingSectors_Star_Step2()
        {
            _game.Map = GameMaps.LoadMap(_game, "Star2");
            _game.Map.SetVisibilityToTeam(1, true);

            GameEntity otherEnd;
            var        next = _game.NextWormholeEnd(1, 1, 4, out otherEnd);

            next.ShouldNotBeNull();
            otherEnd.ShouldNotBeNull();

            next.SectorId.ShouldBe(1);
            otherEnd.SectorId.ShouldBe(2);
        }
コード例 #11
0
        public void TestNextWormholesWhenSomeVisible()
        {
            _game.Map = GameMaps.LoadMap(_game, "Star2");
            _game.Map.Sectors[0].SetVisibleToTeam(0, true);
            _game.Map.Sectors[1].SetVisibleToTeam(0, true);
            _game.Map.Sectors[2].SetVisibleToTeam(0, true);

            GameEntity otherEnd;
            var        next = _game.NextWormholeEnd(1, 0, 2, out otherEnd);

            next.ShouldNotBeNull();
            otherEnd.ShouldNotBeNull();

            next.SectorId.ShouldBe(0);
            otherEnd.SectorId.ShouldBe(1);
        }
コード例 #12
0
        public void TestPathBetweenStartingSectors_PinWheel3()
        {
            var target = GameMaps.LoadMap(_game, "PinWheel3");

            target.SetVisibilityToTeam(1, true);

            var start = target.Sectors.First(_ => _.StartingSector != 0);
            var mid   = target.Sectors.Where(_ => _.StartingSector != 0).Skip(1).First();
            var end   = target.Sectors.Last(_ => _.StartingSector != 0);

            var path1 = target.ShortestPath(1, start.Id, end.Id);

            path1.ShouldNotBeNull();
            path1.Count.ShouldBe(4);

            var path2 = target.ShortestPath(1, start.Id, mid.Id);

            path2.ShouldNotBeNull();
            path2.Count.ShouldBe(3);
        }