public static void SpawnRegion(RegionConfig region, TileManager target) { TileManager instance = Instantiate(region.TileSet).gameObject.GetComponent <TileManager>(); target.AppendGrid(instance); //spawn the units and shit UnitSpawnManager spawner = instance.GetComponent <UnitSpawnManager>(); List <UnitSpawnGroupConfig> groups = RegionLoader.GetGroupsForPower(region); if (region.SpawnSquad) { groups.Add(SquadManager.MakeSquadGroup()); } // MDebug.Log("Spawn Groups " + groups.Count); spawner.SpawnGroups(groups); }
void TileManagerTools() { if (Grid == null) { return; } if (Selection.activeGameObject != null && Selection.activeGameObject != Grid.gameObject && Selection.activeGameObject.GetComponent <TileManager>() != null && GUILayout.Button("Append Grid Test", GUILayout.Width(100)) ) { Grid.AppendGrid(Selection.activeGameObject.GetComponent <TileManager>()); } if (GUILayout.Button("Spawn Random Region")) { // WorldExtender.SpawnRegion( RegionLoader.GetWeightedRegionForLevel(0, new List<RegionConfig>()), Grid); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Spawn Next Region")) { WorldExtender.Instance.SpawnNext(); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Spawn Camp Region")) { // WorldExtender.SpawnRegion(RegionLoader.GetCamp(0), Grid); if (CurrentTileSelection != null) { CurrentTileSelection.Clear(); } } if (GUILayout.Button("Select All")) { CurrentTileSelection.Clear(); CurrentTileSelection.AddRange(Grid.GetTileList()); SelectCurrentTilesInEditor(); } if (GUILayout.Button("Select Border")) { List <Tile> border = TileManager.GetBorderTiles(CurrentTileSelection, Grid, true); CurrentTileSelection.Clear(); CurrentTileSelection.AddRange(border); SelectCurrentTilesInEditor(); } if (GUILayout.Button("Show Current Crumble Weights")) { if (weighted == null) { weighted = TileWeighted.GetWeightedTiles(Grid); } else { weighted = null; } SceneView.RepaintAll(); } if (GUILayout.Button("Reset Tile Visual States")) { foreach (Tile t in Grid.FetchTiles()) { t.SetBaseState(); } } if (Application.isPlaying && GUILayout.Button("Test Crumble")) { TileWeighted.GetCrumbleTiles(20, Grid).ForEach(t => t.StartCrumble()); // MDebug.Log(Grid.GetLastActiveRow()); Grid.GetTileList().ForEach(t => t.OnCrumbleTurn(0)); SceneView.RepaintAll(); } if (GUILayout.Button("Spawn Meshes")) { List <Tile> tiles = Grid.GetTileList(); foreach (Tile t in tiles) { TileEditor.SpawnMesh(t); } SceneView.RepaintAll(); } if (GUILayout.Button("Bake")) { BakeGrid.Bake(Grid); SceneView.RepaintAll(); } }