public void Refresh() { if (!HasParentDungeon) { //if dungeon chunk is -1 then it can be found in our chunk WorldChunk chunk = null; if (State.DungeonChunkID < 0) { chunk = worlditem.Group.GetParentChunk(); } else { if (!GameWorld.Get.ChunkByID(State.DungeonChunkID, out chunk)) { Debug.Log("Couldn't get dungeon parent chunk in dungeon entrance " + name); } } if (!chunk.GetOrCreateDungeon(State.DungeonName, out ParentDungeon)) { Debug.Log("Couldn't get parent dungeon in dungeon entrance " + name); return; } } ParentDungeon.OnEntranceVisible(); Structures.AddMinorToload(State.EntranceStructure, 0, worlditem); }
public void OnLocationGroupLoaded() { Structures.AddMinorToload(State.GraveyardStructure, 0, worlditem); if (!State.CreatedHeadstones) { //create headstones the first time we load the location group //after that they'll just load and unload normally WorldItem headstoneWorldItem = null; State.CreatedHeadstones = true; for (int i = 0; i < State.HeadstoneSpawnPoints.Count; i++) { if (WorldItems.CloneRandomFromCategory(State.HeadstoneCategory, location.LocationGroup, State.HeadstoneSpawnPoints[i], out headstoneWorldItem)) { headstoneWorldItem.Initialize(); HeadstoneAvatar hsa = headstoneWorldItem.Get <HeadstoneAvatar>(); if (i < State.Headstones.Count) { hsa.State.HeadstoneName = State.Headstones[i]; } hsa.RefreshProps(); } } } }
public void OnVisible() { //the spawner will take care of creating any NEW creatures //this function will take care of re-spawning any saved creatures Location location = null; if (worlditem.Is <Location>(out location)) { WIGroup group = location.LocationGroup; if (!string.IsNullOrEmpty(State.DenStructure.TemplateName)) { Structures.AddMinorToload(State.DenStructure, 0, worlditem); } } }
public IEnumerator SpawnMinorStructuresOverTime() { for (int i = 0; i < State.MinorStructures.Count; i++) { //they may have been asked to unload //so we'll need to wait until the structure manager is through with them while (mSpawningMinorStructures && Structures.IsUnloadingMinor(State.MinorStructures [i])) { Debug.Log("Waiting for minor structure to unload first"); yield return(null); } Structures.AddMinorToload(State.MinorStructures [i], i, worlditem); yield return(null); } HasSpawnedMinorStructures = true; mSpawningMinorStructures = false; yield break; }