A class in Root.Township, Alta.Networking.
Part of the static world that can be swapped between an original and a modified look (a cleared rock, opened passage and so on). Its state comes from ModifiableStaticManager by hash.
Constructors
| Member | What it is |
|---|
ModifiableStaticObject() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected bool isModified | Whether it's currently in its modified state. |
7 private and internal fields
| Member | What it is |
|---|
private bool canReturn | If true the object can go back to its original state, so Modify keeps the original objects instead of destroying them. |
private int hash | Backing field for Hash, set in the editor by OnValidate. |
private ModifiableStaticEvent modifiedEvent | Backing field for ModifiedEvent, run when the object is modified live. |
private GameObject[] modifiedObjects | Objects turned on when modified and off when unmodified. |
private ModifiableStaticEvent modifyInstant | Event run instead of modifiedEvent when the object starts already modified (no live change). |
private GameObject[] originalObjects | Objects shown before the change. Destroyed on modify unless canReturn is set. |
private ModifiableStaticEvent unModifiedEvent | Backing field for UnModifiedEvent. |
Properties
Methods
| Member | What it is |
|---|
void Modify(bool hasEvents = true) | Shows the modified objects. The originals are destroyed unless it can return, in which case they stay active. |
void UnModify(bool hasEvents = true) | Shows the original objects and hides the modified ones. |
protected virtual void OnValidate() | Editor: makes sure it has a hash. |
protected virtual void Start() | Reads its state from the manager and applies it without events. |
5 private and internal methods
| Member | What it is |
|---|
private void IChangeWithChunking.BeforeSaving() | Does nothing. |
private void CheckChange(uint objectHash, bool isModified) | Handler for ModifiableStaticManager.ObjectChanged: if the hash is this object's, modifies or unmodifies it with events. |
private void IChangeWithChunking.Loaded() | Does nothing. |
private void OnDisable() | Stops listening for changes and removes the object from ModifiableStaticManager. |
private void OnEnable() | Listens for changes and registers the object with ModifiableStaticManager by hash. |
Used in
Members of other types that take, return or hold a ModifiableStaticObject: