Door
An abstract class in Root.Township, the global namespace.
Base for networked doors with a saved open/closed state that the server syncs to players. Subclasses implement HandleChange to animate it.
- Listed in Global namespace: C to D
- Inherits or implements
NetworkEntityBehaviour,ISavable<DoorSaveData>,ISavableSave<DoorSaveData>,ISavableSaveBase - Derived types
DoorSaveData,SlidingDoor
Constructors
| Member | What it is |
|---|---|
protected Door() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
| Member | What it is |
|---|---|
private bool isOpen | Backing field for IsOpen; also the saved value. |
private MethodSync sync | Method sync used for the open state. |
Properties
| Member | What it is |
|---|---|
bool IsOpen { get; } | Whether the door is currently open. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the method sync for the open state. |
override void OnConnected(Player player) | Sends the current open state to a joining player. |
void SetOpen(bool isOpen) | Server: sets the open state, syncs it to the chunks and calls HandleChange if it changed. |
protected abstract void HandleChange() | Called when the open state changes, on the server in SetOpen and on clients when a sync arrives. |