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(); }
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()); }
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(); }