/// <summary> /// Toggle the timer if the disk has been inserted /// </summary> public void TimerSetButton() { if (nuke.NukeSlot.IsEmpty) { this.TryStopCoroutine(ref corHandler); this.StartCoroutine(UpdateDisplay("Insert the disk!", "Insert the disk!"), ref corHandler); return; } bool?isTimer = Nuke.ToggleTimer(); if (isTimer != null) { this.TryStopCoroutine(ref corHandler); Clear(); InfoTimerColor.SetValueServer(isTimer.Value ? colorGreen : colorRed); this.TryStopCoroutine(ref corHandler); this.StartCoroutine(UpdateDisplay("Timer is: " + (isTimer.Value ? "On" : "Off"), (isTimer.Value ? "Set countdown timer:" : "Nuclear detonation aborted!")), ref corHandler); if (!isTimer.Value) { //Clear countdown timer upon disabling it InfoTimerDisplay.SetValueServer(""); } } else { this.TryStopCoroutine(ref corHandler); this.StartCoroutine(UpdateDisplay("Safety is on!", "Nuke is unarmed!"), ref corHandler); } }
IEnumerator WaitForProvider() { while (Provider == null) { yield return(WaitFor.EndOfFrame); } InfoTimerDisplay.SetValueServer(FormatTime(nuke.CurrentTimerSeconds)); nuke.OnTimerUpdate.AddListener(timerSeconds => { InfoTimerDisplay.SetValueServer(FormatTime(timerSeconds)); }); Logger.Log(nameof(WaitForProvider), Category.NetUI); }