A class in Root.Township, Alta.Inventory.
A lock that is used up: when unlocked it breaks the key and plays an unlock animation, and Break destroys the lock itself.
Constructors
| Member | What it is |
|---|
ConsumableLock() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private NetworkAnimator animator | Network animator that plays the Unlock trigger. |
private LockEvent lockBreakEvent | Backing field for LockBreakEvent. |
private MethodSync requestEffect | Network message used to send the break to clients. |
Properties
| Member | What it is |
|---|
LockEvent LockBreakEvent { get; } | Event fired when the lock breaks, on the server and (through a network message) on clients. |
Methods
| Member | What it is |
|---|
void Break() | Server: fires the break event, tells the chunk's clients, and destroys the lock entity. |
override void Initialize() | Sets up the network message that plays the break effect on clients. |
protected override void Unlocked() | Removes the key joint, frees the rigidbody and, on the server, breaks the key and fires the Unlock trigger. |
1 private and internal method
| Member | What it is |
|---|
private void NetworkBreak(IPlayer player, Stream stream) | Client: fires the break event when the server reports the lock broke. |