private void HandlePressUp() { Debug.LogFormat("[Mystery Widget #{0}] Released on: {1}.", id, (int)Math.Floor(Info.GetTime())); if (Ready && (pressedOn == (int)Math.Floor(Info.GetTime()) + 3 || pressedOn == (int)Math.Floor(Info.GetTime()) - 3)) { Debug.LogFormat("[Mystery Widget #{0}] Correct! Solve.", id); isSolved = true; ActiveModule.HandlePass(); StartCoroutine(UnCover()); Ready = false; } else if (current != null && (pressedOn == (int)Math.Floor(Info.GetTime()) + 1 || pressedOn == (int)Math.Floor(Info.GetTime()) - 1)) { Debug.LogFormat("[Mystery Widget #{0}] Failswitch! Taking off time.", id); TimeRemaining.FromModule(ActiveModule, Info.GetTime() * 0.8f); Displayed = false; valid.Remove(current); } else { Debug.LogFormat("[Mystery Widget #{0}] Wrong! Strike.", id); ActiveModule.HandleStrike(); } }
private void Start() { moduleId = moduleIdCounter++; Debug.LogFormat(@"[Mystery Module #{0}] Version: 4.0", moduleId); LED.range *= transform.lossyScale.x; NextModule.OnInteract += delegate { if (moduleSolved || strikeActive) { return(false); } NextModule.AddInteractionPunch(); Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, NextModule.transform); if (FailswitchPressed) { FailswitchPressed = false; StartCoroutine(FailSwitchAborted()); return(false); } if (!nextStage) { StartCoroutine(StrikeHandler()); return(false); } if (failsolve) { StartCoroutine(UnlockMystery()); return(false); } Debug.LogFormat(@"[Mystery Module #{0}] Advancing to the next stage after solving {1}", moduleId, keyModules[0].ModuleDisplayName); keyModules.RemoveAt(0); nextStage = false; SetLED(255, 0, 0); SetKey(); return(false); }; Failswitch.OnInteract += delegate { if (moduleSolved || strikeActive) { return(false); } Failswitch.AddInteractionPunch(); Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, Failswitch.transform); if (FailswitchPressed) { StartCoroutine(UnlockMystery()); Debug.LogFormat(@"[Mystery Module #{0}] 'Failswitch' was pressed - Remaining time was cut by a quarter", moduleId); if (failsolve) { setScreen("Why would you do that!?", 255, 0, 0); } TimeRemaining.FromModule(Module, Bomb.GetTime() * 0.75f); return(false); } FailswitchPressed = true; Debug.LogFormat(@"[Mystery Module #{0}] Defuser was asked if he really wants to press the Fail Switch", moduleId); setScreen("Are you sure?", 255, 0, 0); return(false); }; StartCoroutine(Setup()); }