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
| Member | What it is |
|---|
LogicGateReceiver() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private bool currentValue | Last output value. |
private bool isInversedOutput | Inverts the output. |
private BoolUnityEvent onValueUpdated | Unity event fired with the new output. |
private LogicOperationType operationType | Which operation combines the inputs. |
Methods
| Member | What 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
| Member | What 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. |