public void SetPressed(bool press) { if (InkHandler.Instance.WaitingForMore) { ButtonAdvance.Highlight(); return; } if (Lit) { // Remove from port if inside //if ( !press && Wire.Port != null ) //{ // Wire.TryPickup( true ); // Wire.TryDrop(); //} // Only one at a time! if (press) { if (CurrentSwitch != null) { CurrentSwitch.SetPressed(false); } CurrentSwitch = this; } else { CurrentSwitch = null; } // Portraits/Name if (press) { PortraitUpdater.Instance.SetPortrait(Number); CharacterNameText.Instance.Set(Game.Instance.GetCharacterName(Number - 1)); } else { PortraitUpdater.Instance.SetPortrait(-1); } // Sound if (press) { StaticHelpers.SpawnResourceAudioSource("switch1", Vector3.zero, Random.Range(0.6f, 1.0f)); } else { StaticHelpers.SpawnResourceAudioSource("switch2", Vector3.zero, Random.Range(0.6f, 1.0f)); } // Start story if pressed Game.Instance.OnSwitchStateChanged(Number, press); Pressed = press; UpdateSprite(); } }
public void TryPickup(bool forced = false) { if (InkHandler.Instance.WaitingForMore) { ButtonAdvance.Highlight(); return; } if (Switch.Pressed) { Pickup(forced); } }
private void Awake() { Instance = this; }