protected static void triggerLoaded() { if (LevelHierarchy.loaded != null) { LevelHierarchy.loaded(); } }
protected static void triggerItemAdded(IDevkitHierarchyItem item) { if (LevelHierarchy.itemAdded != null) { LevelHierarchy.itemAdded(item); } }
public static void initItem(IDevkitHierarchyItem item) { if (item.instanceID == 0u) { item.instanceID = LevelHierarchy.generateUniqueInstanceID(); } }
protected static void triggerReady() { if (LevelHierarchy.ready != null) { LevelHierarchy.ready(); } }
protected void OnDisable() { if (this.levelObject != null) { LevelObjects.unregisterDevkitObject(this.levelObject, this.x, this.y); } LevelHierarchy.removeItem(this); }
protected void OnEnable() { LevelHierarchy.addItem(this); if (this.levelObject != null) { LevelObjects.registerDevkitObject(this.levelObject, out this.x, out this.y); } }
public virtual void read(IFormattedFileReader reader) { if (reader.containsKey("Available_Instance_ID")) { LevelHierarchy.availableInstanceID = reader.readValue <uint>("Available_Instance_ID"); } else { LevelHierarchy.availableInstanceID = 1u; } int num = reader.readArrayLength("Items"); for (int i = 0; i < num; i++) { IFormattedFileReader formattedFileReader = reader.readObject(i); Type type = formattedFileReader.readValue <Type>("Type"); if (type == null) { Debug.LogError(string.Concat(new object[] { "Level hierarchy item index ", i, " missing type: ", formattedFileReader.readValue("Type") })); } else { IDevkitHierarchyItem devkitHierarchyItem; if (typeof(MonoBehaviour).IsAssignableFrom(type)) { devkitHierarchyItem = (new GameObject { name = type.Name }.AddComponent(type) as IDevkitHierarchyItem); } else { devkitHierarchyItem = (Activator.CreateInstance(type) as IDevkitHierarchyItem); } if (devkitHierarchyItem != null) { if (formattedFileReader.containsKey("Instance_ID")) { devkitHierarchyItem.instanceID = formattedFileReader.readValue <uint>("Instance_ID"); } if (devkitHierarchyItem.instanceID == 0u) { devkitHierarchyItem.instanceID = LevelHierarchy.generateUniqueInstanceID(); } formattedFileReader.readKey("Item"); devkitHierarchyItem.read(formattedFileReader); } } } }
protected static void triggerItemRemoved(IDevkitHierarchyItem item) { if (Level.isExiting) { return; } if (LevelHierarchy.itemRemoved != null) { LevelHierarchy.itemRemoved(item); } }
public void load() { string path = Level.info.path + "/Level.hierarchy"; if (File.Exists(path)) { using (StreamReader streamReader = new StreamReader(path)) { IFormattedFileReader reader = new KeyValueTableReader(streamReader); this.read(reader); } } LevelHierarchy.triggerLoaded(); TimeUtility.updated += this.handleLoadUpdated; }
public static void instantiate(Type type, Vector3 position, Quaternion rotation, Vector3 scale) { if (!Level.isEditor) { return; } TranslationReference newReference = new TranslationReference("#SDG::Devkit.Transactions.Spawn"); TranslatedText translatedText = new TranslatedText(newReference); translatedText.format(type.Name); DevkitTransactionManager.beginTransaction(translatedText); IDevkitHierarchySpawnable devkitHierarchySpawnable; if (typeof(MonoBehaviour).IsAssignableFrom(type)) { GameObject gameObject = new GameObject(); gameObject.name = type.Name; gameObject.transform.position = position; gameObject.transform.rotation = rotation; gameObject.transform.localScale = scale; DevkitTransactionUtility.recordInstantiation(gameObject); devkitHierarchySpawnable = (gameObject.AddComponent(type) as IDevkitHierarchySpawnable); } else { devkitHierarchySpawnable = (Activator.CreateInstance(type) as IDevkitHierarchySpawnable); } if (devkitHierarchySpawnable != null) { devkitHierarchySpawnable.devkitHierarchySpawn(); } IDevkitHierarchyItem devkitHierarchyItem = devkitHierarchySpawnable as IDevkitHierarchyItem; if (devkitHierarchyItem != null) { LevelHierarchy.initItem(devkitHierarchyItem); } DevkitTransactionManager.endTransaction(); }
protected void OnDisable() { SpawnpointSystem.removeSpawnpoint(this); LevelHierarchy.removeItem(this); }
// Token: 0x06000903 RID: 2307 RVA: 0x0004E48F File Offset: 0x0004C88F protected void OnDisable() { DeadzoneSystem.removeVolume(this); LevelHierarchy.removeItem(this); }
protected void OnEnable() { LevelHierarchy.addItem(this); SpawnpointSystem.addSpawnpoint(this); }
protected void OnDisable() { PlayerClipVolumeSystem.removeVolume(this); LevelHierarchy.removeItem(this); }
// Token: 0x06000902 RID: 2306 RVA: 0x0004E481 File Offset: 0x0004C881 protected void OnEnable() { LevelHierarchy.addItem(this); DeadzoneSystem.addVolume(this); }
// Token: 0x060008F0 RID: 2288 RVA: 0x0004E1D2 File Offset: 0x0004C5D2 protected void OnDisable() { AmbianceSystem.removeVolume(this); LevelHierarchy.removeItem(this); }
protected void OnEnable() { LevelHierarchy.addItem(this); PlayerClipVolumeSystem.addVolume(this); }
// Token: 0x060008EF RID: 2287 RVA: 0x0004E1C4 File Offset: 0x0004C5C4 protected void OnEnable() { LevelHierarchy.addItem(this); AmbianceSystem.addVolume(this); }
protected void handleLoadUpdated() { TimeUtility.updated -= this.handleLoadUpdated; LevelHierarchy.triggerReady(); }
public static void addItem(IDevkitHierarchyItem item) { LevelHierarchy.instance.items.Add(item); LevelHierarchy.triggerItemAdded(item); }
protected void OnEnable() { LevelHierarchy.addItem(this); EffectVolumeSystem.addVolume(this); }
public static void removeItem(IDevkitHierarchyItem item) { LevelHierarchy.instance.items.Remove(item); LevelHierarchy.triggerItemRemoved(item); }