Esempio n. 1
0
        static public void TestMapTerrain(GameMap map)
        {
            // Initialize default map terrain
            ArrayMap2D <Terrain> arraymap = new ArrayMap2D <Terrain>(map.Width, map.Height);

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    if (y == map.Height / 2 && x > 5)
                    {
                        arraymap[x, y] = new SimpleWall();
                    }
                    else if (y == map.Height / 4 && x < map.Width - 5)
                    {
                        arraymap[x, y] = new SimpleWall();
                    }
                    else if (y == (map.Height / 4) + (map.Height / 2) && x < map.Width - 5)
                    {
                        arraymap[x, y] = new SimpleWall();
                    }
                    else
                    {
                        arraymap[x, y] = new SimpleFloor();
                    }
                }
            }

            // Initialize the map object
            //ApplyTerrainOverlay(arraymap);
            map.TerrainTiles = arraymap;
        }
Esempio n. 2
0
        static private void AddRoomToArrayMap(ArrayMap2D <Terrain> array, Room room)
        {
            // Add floors
            for (int x = room.Position.X; x < room.Position.X + room.Width; x++)
            {
                for (int y = room.Position.Y; y < room.Position.Y + room.Height; y++)
                {
                    array[x, y] = new SimpleFloor();
                }
            }

            // Add walls
            for (int x = room.Position.X - 1; x < room.Position.X + room.Width + 1; x++)
            {
                array[x, room.Position.Y - 1]           = new SimpleWall();
                array[x, room.Position.Y + room.Height] = new SimpleWall();
            }

            for (int y = room.Position.Y; y < room.Position.Y + room.Height; y++)
            {
                array[room.Position.X - 1, y]          = new SimpleWall();
                array[room.Position.X + room.Width, y] = new SimpleWall();
            }
        }