Beispiel #1
0
        public void BombExplosionNearBreakableWallTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[13, 13][0] is Player)
            {
                Player player = map.getMapContainer()[13, 13][0] as Player;
                mapManager.PlaceBomb(player);
                Bomb bomb = map.getMapContainer()[13, 13][1] as Bomb;
                map.AddMapObj(new Wall(true, new Coordinates(12, 13)));
                bomb.Explode();
                Thread.Sleep(1100);
                //po sprogimo sienos nebelieka arba po jos lieka powerUp
                if (map.getMapContainer()[12, 13].Count == 1)
                {
                    Assert.True(true);
                }
                else if (map.getMapContainer()[12, 13].Count == 2)
                {
                    Assert.True(map.getMapContainer()[12, 13][0] is PowerUp || map.getMapContainer()[12, 13][1] is PowerUp, "nevienas ne powerUp, bet 2");
                }
                else
                {
                    Assert.True(false, "sienai susprogus atsirado daugiau arba maziau obijektu nei turejo");
                }

                Assert.Single(map.getMapContainer()[13, 14]);
            }
            else
            {
                Assert.True(false, "player not found");
            }
            map.removeMap();
        }
Beispiel #2
0
        public void PlayerPlantDifferentAmountOfBombs(int plantBombCount)
        {
            Map map = Map.GetInstance;

            map.CleanArena();
            Player         player     = new Player(3, 2, 3, 1, new Coordinates(6, 6));
            MapManagerStub mapManager = new MapManagerStub();
            int            maxNumber  = player.NumberOfBombs;

            for (int i = 0; i < plantBombCount; i++)
            {
                mapManager.PlaceBomb(player);
                player.Coordinates.PosY++;
            }
            int posBomb = player.PlacedBombCount;

            if (plantBombCount >= maxNumber)
            {
                Assert.Equal(maxNumber, posBomb);
            }
            else
            {
                Assert.Equal(plantBombCount, posBomb);
            }
            map.removeMap();
        }
 public void Hit(Wall wall, CompositeExplosion compositeExplosion)
 {
     if (wall.isDestroyable())
     {
         MapManagerStub MapManagerStub = new MapManagerStub();
         MapManagerStub.CreateExplosion(wall.Coordinates, wall, compositeExplosion);
     }
 }
Beispiel #4
0
        public void RedPlayerCreateTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            Assert.True(map.getMapContainer()[13, 13][0] is RedPlayer, "not a red player");
            map.removeMap();
        }
Beispiel #5
0
        public void BluePlayerCreateTest()
        {
            Map map = Map.GetInstance;

            map.CleanArena();
            BluePlayer     player     = new BluePlayer(1, 1, 1, 1, new Coordinates(5, 5));
            MapManagerStub mapManager = new MapManagerStub();

            map.AddMapObj(player);
            Assert.True(map.getMapContainer()[5, 5][0] is BluePlayer, "not a blue player");
            map.removeMap();
        }
Beispiel #6
0
        public void RedPlayerPlantRedBombTest()
        {
            Map map = Map.GetInstance;

            map.CleanArena();
            MapManagerStub mapManager = new MapManagerStub();
            RedPlayer      player     = new RedPlayer(1, 1, 1, 1, new Coordinates(5, 5));

            mapManager.PlaceBomb(player);
            Assert.True(map.getMapContainer()[5, 5][0] is RedBomb, "not a blue bomb");
            map.removeMap();
        }
Beispiel #7
0
        public void BombDecoratorTest()
        {
            Map map = Map.GetInstance;

            map.CleanArena();
            MapManagerStub mapManager = new MapManagerStub();
            BluePlayer     player     = new BluePlayer(1, 1, 1, 1, new Coordinates(5, 5));

            mapManager.PlaceBomb(player);
            BlueBomb bomb = map.getMapContainer()[5, 5][0] as BlueBomb;

            Assert.Equal(2, bomb.decorations.Count);
            map.removeMap();
        }
Beispiel #8
0
        public void BlueBombGetColorTest()
        {
            Map map = Map.GetInstance;

            map.CleanArena();
            MapManagerStub mapManager = new MapManagerStub();
            BluePlayer     player     = new BluePlayer(1, 1, 1, 1, new Coordinates(5, 5));

            mapManager.PlaceBomb(player);
            BlueBomb bomb = map.getMapContainer()[5, 5][0] as BlueBomb;

            Assert.Equal(Color.FromKnownColor(KnownColor.Blue), bomb.GetColor());
            map.removeMap();
        }
Beispiel #9
0
        public void TwoBombsInSingleSpace()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[13, 13][0] is Player)
            {
                Player player = map.getMapContainer()[13, 13][0] as Player;
                int    pre    = map.getMapContainer()[13, 13].Count;
                mapManager.PlaceBomb(player);
                mapManager.PlaceBomb(player);
                int pos = map.getMapContainer()[13, 13].Count;
                Assert.Equal(pre + 1, pos);
            }
            map.removeMap();
        }
        public List <MapObject>[,] GetGameMap()
        {
            //if (GlobalVar.gm == null || GlobalVar.gm.map == null)
            //{
            //return NoContent();
            //}
            List <MapObject>[,] map = new MapManagerStub().BuildMap().getMapContainer();

            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    if (map[i, j] != null)
                    {
                        for (int k = 0; k < map[i, j].Count; k++)
                        {
                            if (map[i, j][k] is Wall)
                            {
                                map[i, j][k] = map[i, j][k] as Wall;
                            }
                            if (map[i, j][k] is Bomb)
                            {
                                map[i, j][k] = map[i, j][k] as Bomb;
                            }
                            if (map[i, j][k] is PowerUp)
                            {
                                map[i, j][k] = map[i, j][k] as PowerUp;
                            }
                            if (map[i, j][k] is RedPlayer)
                            {
                                map[i, j][k] = map[i, j][k] as RedPlayer;
                            }
                            if (map[i, j][k] is BluePlayer)
                            {
                                map[i, j][k] = map[i, j][k] as BluePlayer;
                            }
                            if (map[i, j][k] is Explosion)
                            {
                                map[i, j][k] = map[i, j][k] as Explosion;
                            }
                        }
                    }
                }
            }
            return(map);
        }
Beispiel #11
0
        public void BombAutoDetonateTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[13, 13][0] is Player)
            {
                Player player = map.getMapContainer()[13, 13][0] as Player;
                mapManager.PlaceBomb(player);
                Thread.Sleep(3100);
                Assert.True(map.getMapContainer()[13, 13][1] is Explosion);
            }
            else
            {
                Assert.True(false, "did not detonate");
            }
            map.removeMap();
        }
Beispiel #12
0
        public void BombExplosionNearUnbreakableWallTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[13, 13][0] is Player)
            {
                Player player = map.getMapContainer()[13, 13][0] as Player;
                mapManager.PlaceBomb(player);
                Bomb bomb = map.getMapContainer()[13, 13][1] as Bomb;
                bomb.Explode();
                Assert.Single(map.getMapContainer()[13, 14]);
            }
            else
            {
                Assert.True(false, "player not found");
            }
            map.removeMap();
        }
Beispiel #13
0
        public void PlayerPlantBombOnUserTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[1, 1][0] is Player)
            {
                Player player  = map.getMapContainer()[1, 1][0] as Player;
                int    preBomb = player.PlacedBombCount;
                mapManager.PlaceBomb(player);
                int posBomb = player.PlacedBombCount;
                Assert.Equal(preBomb + 1, posBomb);
            }
            else
            {
                Assert.True(false, "player not found");
            }
            map.removeMap();
        }
Beispiel #14
0
        public void BombExplosionOnPlayerTest()
        {
            Map            map        = Map.GetInstance;
            MapManagerStub mapManager = new MapManagerStub();

            if (map.getMapContainer()[13, 13][0] is Player)
            {
                Player player = map.getMapContainer()[13, 13][0] as Player;
                mapManager.PlaceBomb(player);
                int  initial = player.Health;
                Bomb bomb    = map.getMapContainer()[13, 13][1] as Bomb;
                bomb.Explode();
                int after     = player.Health;
                var container = map.getMapContainer();
                Assert.Equal(initial - 1, after);
            }
            else
            {
                Assert.True(false, "player not found");
            }
            map.removeMap();
        }
 public KickMove()
 {
     map = new MapManagerStub();
 }
 public SimplePlant()
 {
     map = new MapManagerStub();
 }
Beispiel #17
0
 public ThrowMove()
 {
     map = new MapManagerStub();
 }