Ejemplo n.º 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();
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 15
0
 public KickMove()
 {
     map = new MapManagerStub();
 }
Ejemplo n.º 16
0
 public SimplePlant()
 {
     map = new MapManagerStub();
 }
Ejemplo n.º 17
0
 public ThrowMove()
 {
     map = new MapManagerStub();
 }