Exemplo n.º 1
0
    /// <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);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Toggle safety if the nuke disk has been inserted and the code has been entered
    /// </summary>
    public void SafetyToggle()
    {
        if (nuke.NukeSlot.IsEmpty)
        {
            this.TryStopCoroutine(ref corHandler);
            this.StartCoroutine(UpdateDisplay("Insert the disk!", "Insert the disk!"), ref corHandler);
            return;
        }
        bool?isSafety = Nuke.SafetyNuke();

        if (isSafety != null)
        {
            InfoSafetyColor.SetValueServer(isSafety.Value ? colorGreen : colorRed);
            if (isSafety.Value)
            {
                InfoTimerColor.SetValueServer(colorRed);
            }
            this.TryStopCoroutine(ref corHandler);
            this.StartCoroutine(UpdateDisplay("Safety is: " + (isSafety.Value ? "On" : "Off"), (isSafety.Value ? "Nuke disarmed!" : "Nuke armed!")), ref corHandler);
        }
        else
        {
            this.TryStopCoroutine(ref corHandler);
            this.StartCoroutine(UpdateDisplay("Enter the code first!", "Input code:"), ref corHandler);
        }
    }