Ejemplo n.º 1
0
 /// <summary>
 /// Initialize the switch to a default state.
 /// </summary>
 /// <param name="digit">The </param>
 public void Setup()
 {
     // Defaults - number is 0, light is red
     IsOn = false;
     activeLight.SetEnabled(true);
     activeLight.SetOn(false);
     number.text = 0.ToString();
 }
    /// <summary>
    /// Checks the binary switches to see if the input matches the target number.
    /// Plays wheel animations based on correctness.
    /// </summary>
    /// <returns>True if the correct number was input, false otherwise.</returns>
    bool CheckLevelCompletion()
    {
        int inputNum = 0;

        // *** Add your source code here ***

        bool complete = inputNum == currentNumber;

        successLight.SetEnabled(true);
        successLight.SetOn(complete);

        CancelInvoke("TurnOffSuccessLight");
        Invoke("TurnOffSuccessLight", 1f);

        // Animations
        wheelAnimator.ResetTrigger("AcceptedCode");
        wheelAnimator.ResetTrigger("FailedCode");
        if (complete)
        {
            wheelAnimator.SetTrigger("AcceptedCode");
            wheelCorrectSource.Play();
        }
        else
        {
            wheelAnimator.SetTrigger("FailedCode");
            if (!wheelFailedSource.isPlaying)
            {
                wheelFailedSource.Play();
            }
        }

        return(complete);
    }