Exemplo n.º 1
0
        void GenerateMap()
        {
            if (mapPositionsFloor != null)
            {
                // Clean map for now
                for (int i = 0; i < mapWidth; i++)
                {
                    for (int j = 0; j < mapHeight; j++)
                    {
                        if (mapPositionsFloor[i, j] != null)
                        {
                            Destroy(mapPositionsFloor[i, j]);
                        }
                    }
                }
            }

            mapPositionsFloor = new GameObject[mapWidth, mapHeight];
            if (mapType == 0)
            {
                //BSP
                generator = new BSPTree <Map>(mapWidth, mapHeight, maxSize, minSize, maxRoom, minRoom, new System.Random(DateTime.Now.Millisecond));
                map       = Map.Create(generator);
            }
            else if (mapType == 1)
            {
                //Cave
            }
            else if (mapType == 2)
            {
                //Maze
            }
            DrawMap();
        }
Exemplo n.º 2
0
Arquivo: Map.cs Projeto: JerLai/DunGen
        public static T Create <T>(IMapGen <T> mapCreationStrategy) where T : IMap
        {
            if (mapCreationStrategy == null)
            {
                Debug.LogError(nameof(mapCreationStrategy) + "Map creation strategy cannot be null");
            }

            return(mapCreationStrategy.GenerateMap());
        }
Exemplo n.º 3
0
 void GenerateMap()
 {
     mapPositionsFloor = new GameObject[mapWidth, mapHeight];
     if (mapType == 0)
     {
         //BSP
         generator = new BSPTree <Map>(mapWidth, mapHeight, maxSize, minSize, maxRoom, minRoom, new System.Random(DateTime.Now.Millisecond));
         map       = Map.Create(generator);
     }
     else if (mapType == 1)
     {
         //Cave
     }
     else if (mapType == 2)
     {
         //Maze
     }
     DrawMap();
 }