MRK_ActivationLever
A class in Root.Township, the global namespace.
A pay-to-activate mechanism: filling the input dock with as many items as the cost dock shows makes it active, raises a column and fires events. The server decides; Refresh resets it.
- Listed in Global namespace: M to O
- Inherits or implements
NetworkEntityBehaviour,ISavable<MRK_ActivationLeverSaveData>,ISavableSave<MRK_ActivationLeverSaveData>,ISavableSaveBase - Derived types
MRK_ActivationLeverSaveData - Documented in Buttons and levers
Constructors
| Member | What it is |
|---|---|
MRK_ActivationLever() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private AltaCoroutine columnAnimation | The running column animation coroutine. |
private DurationCurve columnMovement | Duration and curve for the column's height. |
private Transform costColumn | Transform moved up when active. |
private PickupDock costDefinition | Dock whose stored items set the price, both item type and amount. |
private PickupDock costInput | Dock players pay into. |
private Transform costOverflowTarget | Where extra items above the price are put. |
private bool isActive | True once paid. Saved with the entity. |
private UnityEvent onBecameActive | Event raised when it becomes active, on server and clients. |
private UnityEvent onBecameInactive | Event raised when it's reset. |
private MethodSyncStruct<bool> syncActive | Method sync for the active state. Its value says whether clients snap instead of animate. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Adds the input dock filter and creates the active state sync. |
override void InitializeAsServer(SpawnData spawnData) | Hooks docking on the input and snaps the column up if it loaded as active. |
override void OnConnected(Player player) | Sends a joining player the active state so their column snaps into place. |
void Refresh() | Server: destroys the paid items, becomes inactive, lowers the column and syncs. |
5 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator AnimateColumn() (iterator) | Coroutine that moves the column up or down along columnMovement's curve. |
private void CheckQuantity(Interactor interactor, Pickup pickup, PickupDock dock) | Server: once the input holds enough, becomes active, pushes any extra items out to costOverflowTarget, animates and syncs. |
private void FilterInput(Interactor interactor, Pickup pickup, ref bool result) | Blocks docking while active, and allows only items the cost dock would accept. |
private void StartAnimateColumn() | Starts the column animation unless it's already running. |
private void SyncActive(IPlayer player, Stream stream, bool isSnapping) | Server to client sync of isActive. Client: snaps or animates the column and raises the matching event. |