Skip to main content

LogicGateReceiver

A class in Root.Township, Alta.Logic.

Logic gate: combines any number of bool inputs with And, Or, Xor, Nand or Toggle, optionally inverted. Runs on the server and saves its inputs and type.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private bool currentValueLast output value.
private bool isInversedOutputInverts the output.
private BoolUnityEvent onValueUpdatedUnity event fired with the new output.
private LogicOperationType operationTypeWhich operation combines the inputs.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: works out the starting value and fires onValueUpdated with it.
protected override void ValueUpdated()When an input changes, fires onValueUpdated if the result changed.
2 private and internal methods
MemberWhat it is
private bool GetValue()Combines the inputs. Xor is true for exactly one true input, Nand for none true, Toggle for an odd count.
private void OnValidate()Editor: renames the object after its operation type, such as And inverse.