PlayerControllerMultiLockModel
A class in Root.Township, the global namespace.
Tracks objects that lock the local player's controls (such as a screen fade) and syncs the locked state to the server. While locked, PlayerHealth ignores damage.
Constructors
| Member | What it is |
|---|
PlayerControllerMultiLockModel() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private HashSet<object> locks | Objects currently holding a lock. |
private PlayerController playerController | The player controller being locked. |
private MethodSync syncLockState | Network message sent to chunks when the state changes. |
Properties
| Member | What it is |
|---|
bool IsLocked { get; private set; } | True while any lock is held. The server takes it from the owning player's message. |
Events
1 private and internal event
| Member | What it is |
|---|
private event Action<bool> onLockStateChanged | Event raised with the new state when the lock changes. |
Methods
| Member | What it is |
|---|
void AddLock(object lockerObject) | Local player only: adds a lock object; the first lock sets IsLocked and syncs it. |
override void Initialize() | Sets up the network message for the lock state. |
void RemoveLock(object lockerObject) | Local player only: removes a lock object; removing the last one clears IsLocked and syncs it. |
1 private and internal method
| Member | What it is |
|---|
private void SyncLockState(IPlayer player, Stream stream) | Serializes the lock state; the server only accepts it from the player who owns this controller. |