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 MakeEnemySpawnTile(Tile t) { UnitSpawnManager manager = t.transform.parent.GetComponent <UnitSpawnManager>(); if (manager == null) { Debug.LogWarning("No UnitSpawn Manager Found in parent of this tile"); } UnitSpawner s = t.GetComponent <UnitSpawner>(); if (s == null) { s = t.gameObject.AddComponent <UnitSpawner>(); } else { DestroyImmediate(s); } EditorUtility.SetDirty(target); }
void Awake() { Instance = this; }