private void OnSwitch(bool up, Switchable source) { // We know these are 1-based if (int.TryParse(source.name, out int id)) { if (!selectedSwitches.Contains(id)) { selectedSwitches.Add(id); } if (!up) { if (id == correctFuseToSwitchOff) { spitznsparkz.SetActive(false); Finish(); } } else if (id == 11 || id == 13) { catastrophicFail = true; spitznsparkz.SetActive(true); LeanAudio.playClipAt(scream, spitznsparkz.transform.position); Finish(); } } }
public void SetSwitch(bool up = true, Switchable source = null) { IsUp = up; ConnectedToCommon = up ? L1 : L2; NotifyOnSwitch?.Invoke(up, source); UpdateConnection(Circuit.TraceTrigger.Switch); }
protected override void Awake() { base.Awake(); switchable = GetComponent <Switchable>(); if (switchable) { switchable.CallOnSwitchId = SetSwitch; } common.OnConnectionChanged = ConnectionChanged; L1.OnConnectionChanged = ConnectionChanged; if (L2) { L2.OnConnectionChanged = ConnectionChanged; } SetSwitch(); }
private void Switched2(bool up, Switchable source) { switch2Test.actionPending = true; Debug.Log("Switched 2 to " + (up ? "up" : "down")); }