Пример #1
0
        private void DebugLevel()
        {
            const int sizeX = 20;
            const int sizeY = 15;

            var mapxd = new[]
                          {
                              "11111111111111111111",
                              "10000000000000000001",
                              "10011000000000000001",
                              "10011000004000000001",
                              "10011000111111000001",
                              "10011001111111101001",
                              "10011001000000101001",
                              "10011001000200101001",
                              "10000000000000000001",
                              "10000000000000000001",
                              "10000011111111110001",
                              "10000011111111110001",
                              "10000000000000000001",
                              "10000000000000000001",
                              "11111111111111111111"
                          };

            var map = new[]
                          {
                              "11111111111111111111",
                              "14400000000000000001",
                              "14401000100001000001",
                              "14401000000000000001",
                              "14401000000011100001",
                              "10001002000011100001",
                              "10001000000011100001",
                              "10000000000011100001",
                              "10000000000011100001",
                              "10010010000011100001",
                              "10000000000000000131",
                              "10001111110000000131",
                              "10001111110000100131",
                              "10000000000000000031",
                              "11111111111111111111"
                          };

            for (var iY = 0; iY < sizeY; iY++)
                for (var iX = 0; iX < sizeX; iX++)
                {
                    if (map.IsValue(iX, iY, 2))
                        Factory.Player(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 1))
                        Factory.Wall(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, map.CalculateWall(iX, iY));

                    if (map.IsValue(iX, iY, 3))
                        Factory.Friendly(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 4))
                        Factory.Enemy(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 5))
                        Factory.BigEnemy(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 6))
                        Factory.BigFriendly(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 7))
                        Factory.BreakableWall(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 9))
                    {
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                        Factory.Bullet(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Utils.Random.Next(0, 360), Utils.Random.Next(0, 25), false);
                    }

                    if (iX <= 0 || iY <= 0 || iX >= sizeX - 1 || iY >= sizeY - 1) continue;
                    if (!map.IsValue(iX, iY, 0)) continue;

                    if (map.IsValue(iX - 1, iY, 1))
                        if (map.IsValue(iX, iY - 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Textures.WallBlack, Tilesets.Wall, "icurve");

                    if (map.IsValue(iX + 1, iY, 1))
                        if (map.IsValue(iX, iY - 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Textures.WallBlack, Tilesets.Wall, "icurve", 90);

                    if (map.IsValue(iX + 1, iY, 1))
                        if (map.IsValue(iX, iY + 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Textures.WallBlack, Tilesets.Wall, "icurve", 180);

                    if (map.IsValue(iX - 1, iY, 1))
                        if (map.IsValue(iX, iY + 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, Textures.WallBlack, Tilesets.Wall, "icurve", 270);
                }
        }
Пример #2
0
        private void DebugLevel()
        {
            const int sizeX = 20;
            const int sizeY = 15;

            var map = new[]
                      {
                          "11111111111111111111",
                          "10010000444400000001",
                          "10100000000000000101",
                          "10000000000000000001",
                          "10000000000000000001",
                          "10000111111000000001",
                          "14000001000000000001",
                          "14001001000100000001",
                          "10001002000100000001",
                          "14001000000100000001",
                          "10001011110100000001",
                          "10000000000000000001",
                          "10100000400000000101",
                          "10044400440000000001",
                          "11111111111111111111"
                      };

            for (var iY = 0; iY < sizeY; iY++)
                for (var iX = 0; iX < sizeX; iX++)
                {
                    if (map.IsValue(iX, iY, 2))
                        Factory.Player(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 1))
                        Factory.Wall(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY, map.CalculateWall(iX, iY));

                    if (map.IsValue(iX, iY, 4))
                        Factory.Enemy(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (map.IsValue(iX, iY, 7))
                        Factory.BreakableWall(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY);

                    if (iX <= 0 || iY <= 0 || iX >= sizeX - 1 || iY >= sizeY - 1) continue;
                    if (!map.IsValue(iX, iY, 0)) continue;

                    if (map.IsValue(iX - 1, iY, 1))
                        if (map.IsValue(iX, iY - 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY,
                                               Textures.Wall, Tilesets.Wall, "icurve");

                    if (map.IsValue(iX + 1, iY, 1))
                        if (map.IsValue(iX, iY - 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY,
                                               Textures.Wall, Tilesets.Wall, "icurve", 90);

                    if (map.IsValue(iX + 1, iY, 1))
                        if (map.IsValue(iX, iY + 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY,
                                               Textures.Wall, Tilesets.Wall, "icurve", 180);

                    if (map.IsValue(iX - 1, iY, 1))
                        if (map.IsValue(iX, iY + 1, 1))
                            Factory.Decoration(8.ToUnits() + 16.ToUnits()*iX, 8.ToUnits() + 16.ToUnits()*iY,
                                               Textures.Wall, Tilesets.Wall, "icurve", 270);
                }
        }