Skip to main content

DockedFireLogic

A class in Root.Township, the global namespace.

Puzzle helper that watches the fire on an item docked in a PlaceItemPuzzleLogic dock and raises a bool event when it lights or goes out.

Constructors​

MemberWhat it is
DockedFireLogic()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private bool activatedByLogicLets ExternalUpdateFire light or put out the fire.
private bool correctIfExtinguishedInverts the value reported on dock, so an unlit fire counts as correct.
private bool currentValueLast value sent through onValueUpdated.
private Fire fireThe fire being watched, found on the docked item or set in the inspector.
private BoolUnityEvent onValueUpdatedEvent raised with the new value whenever it changes.
private PlaceItemPuzzleLogic placeItemPuzzleLogicThe puzzle whose dock is watched.

Methods​

MemberWhat it is
void ExternalUpdateFire(bool value)Lights or extinguishes the tracked fire from outside logic, only when activatedByLogic is set.
4 private and internal methods
MemberWhat it is
private void Awake()Subscribes to the starting fire (if set) and to the puzzle dock's docked and undocked events.
private void DockedItemCheck(Interactor interactor, Pickup pickup, PickupDock dock)On dock, finds the Fire under the dock, subscribes to it and pushes its lit state (inverted when correctIfExtinguished).
private void UndockedItemCheck(Interactor interactor, Pickup pickup, PickupDock dock)When the dock is empty, drops the tracked fire and reports false.
private void UpdateValue(bool value)Stores the new state and invokes onValueUpdated only when it changed.