private static void LoadCreep() { creepDBPrefab = CreepDB.LoadDB(); creepList = creepDBPrefab.creepList; for (int i = 0; i < creepList.Count; i++) { //creepList[i].prefabID=i; if (creepList[i] != null) { creepIDList.Add(creepList[i].prefabID); if (creepList[i].stats.Count == 0) { creepList[i].stats.Add(new UnitStat()); } } else { creepList.RemoveAt(i); i -= 1; } } UpdateCreepNameList(); }
//for filling up empty unit of spawnManager public static UnitCreep GetFirstPrefab() { GameObject obj = Resources.Load("DB_UnitedSolution/CreepDB", typeof(GameObject)) as GameObject; #if UNITY_EDITOR if (obj == null) { obj = CreatePrefab(); } #endif CreepDB instance = obj.GetComponent <CreepDB>(); return(instance.creepList.Count == 0 ? null : instance.creepList[0]); }
public static void Init() { // Get existing open window or if none, make a new one: window = (SpawnEditorWindow)EditorWindow.GetWindow(typeof(SpawnEditorWindow), false, "Spawn Editor"); window.minSize = new Vector2(480, 620); int enumLength = Enum.GetValues(typeof(SpawnManager._SpawnLimit)).Length; spawnLimitLabel = new string[enumLength]; spawnLimitTooltip = new string[enumLength]; for (int i = 0; i < enumLength; i++) { spawnLimitLabel[i] = ((SpawnManager._SpawnLimit)i).ToString(); if ((SpawnManager._SpawnLimit)i == SpawnManager._SpawnLimit.Finite) { spawnLimitTooltip[i] = "Finite number of waves"; } if ((SpawnManager._SpawnLimit)i == SpawnManager._SpawnLimit.Infinite) { spawnLimitTooltip[i] = "Infinite number of waves (for survival or endless mode)"; } } enumLength = Enum.GetValues(typeof(SpawnManager._SpawnMode)).Length; spawnModeLabel = new string[enumLength]; spawnModeTooltip = new string[enumLength]; for (int i = 0; i < enumLength; i++) { spawnModeLabel[i] = ((SpawnManager._SpawnMode)i).ToString(); if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.Continous) { spawnModeTooltip[i] = "A new wave is spawn upon every wave duration countdown (with option to skip the timer)"; } if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.WaveCleared) { spawnModeTooltip[i] = "A new wave is spawned when the current wave is cleared (with option to spawn next wave in advance)"; } if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.Round) { spawnModeTooltip[i] = "Each wave is treated like a round. a new wave can only take place when the previous wave is cleared. Each round require initiation from user"; } } creepList = CreepDB.Load(); rscList = ResourceDB.Load(); GetSpawnManager(); }
static void New2() { EditorApplication.NewScene(); GameObject camObj = Camera.main.gameObject; DestroyImmediate(camObj); GameObject obj = (GameObject)Instantiate(Resources.Load("ScenePrefab/UnitedSolution_OpenPath", typeof(GameObject))); obj.name = "UnitedSolution_OpenPath"; SpawnManager spawnManager = (SpawnManager)FindObjectOfType(typeof(SpawnManager)); if (spawnManager.waveList[0].subWaveList[0].unit == null) { spawnManager.waveList[0].subWaveList[0].unit = CreepDB.GetFirstPrefab().gameObject; } }