Пример #1
0
 public SubMap getMap(int map)
 {
     SubMap ret = new SubMap();
     for (int x = 0; x < 32; x++)
     {
         for (int y = 0; y < 32; y++)
         {
             ret.tiles[x, y] = fact.getTile(x, y, def[map][x, y]);
         }
     }
     return ret;
 }
Пример #2
0
 //public Map(Game game, int x, int y Texture2D spriteMap)
 /// <summary>
 ///
 /// </summary>
 /// <param name="x">tiles X</param>
 /// <param name="y">tiles y</param>
 public Map(int x, int y, Texture2D spriteMap)
 {
     enemyList = new List<Character>();
     characterList = new List<Character>();
     subMaps = new SubMap[x / 32 + 1, y / 32 + 1];
     for (int i = 0; i < x / 32 + 1; i++)
     {
         for (int j = 0; j < y / 32 + 1; j++)
         {
             subMaps[i, j] = new SubMap();
             for (int u = 0; u < 32; u++)
             {
                 for (int v = 0; v < 32; v++)
                 {
                     subMaps[i, j].tiles[u, v] = new Tile(x, y, new Rectangle(10 * 32, 6 * 32, 32, 32), spriteMap);
                 }
             }
         }
     }
     this.worldSize = new Point(x, y);
 }
Пример #3
0
 internal void setSubSector(int i, int j, SubMap subMap)
 {
     subMaps[i, j] = subMap;
 }
Пример #4
0
        public Map(Game game, Vector2 scale, int x, int y, Texture2D spriteMap)
        {
            characterList = new List<Character>();
            enemyList = new List<Character>();
            subMaps = new SubMap[x / 32 + 1, y / 32 + 1];
            for (int i = 0; i < x / 32 + 1; i++)
            {
                for (int j = 0; j < y / 32 + 1; j++)
                {
                    subMaps[i, j] = new SubMap();
                    for (int u = 0; u < 32; u++)
                    {
                        for (int v = 0; v < 32; v++)
                        {
                            subMaps[i, j].tiles[u, v] = new Tile(x, y, new Rectangle(10 * 32, 6 * 32, 32, 32), spriteMap);
                        }
                    }
                }
            }

            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    switch (r.Next(0, 6))
                    {
                        case 0:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(10 * 32, 6 * 32, 32, 32), spriteMap);
                            break;

                        case 1:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(9 * 32, 6 * 32, 32, 32), spriteMap);
                            break;

                        case 2:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(10 * 32, 7 * 32, 32, 32), spriteMap);
                            break;

                        case 3:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(8 * 32, 7 * 32, 32, 32), spriteMap);
                            break;

                        case 4:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(9 * 32, 7 * 32, 32, 32), spriteMap);
                            break;

                        case 5:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(10 * 32, 8 * 32, 32, 32), spriteMap);
                            break;

                        case 6:
                            subMaps[i / 32, j / 32].tiles[i % 32, j % 32] = new Tile(x, y, new Rectangle(10 * 32, 9 * 32, 32, 32), spriteMap);
                            break;
                    }
                }
            }
            worldSize = new Point(100, 100);
            throw new System.InvalidOperationException();

            // TODO: Construct any child components here
        }
Пример #5
0
 public SubMap Clone()
 {
     SubMap clone = new SubMap();
     clone.tiles = (Tile[,])tiles.Clone();
     return clone;
 }