Beispiel #1
0
    public void tick()
    {
        if (currentLevel >= levels.Length)
        {
            return;
        }

        if (step >= Mathf.Pow(2f, levels[currentLevel].input.NumInputs))
        {
            // If no failures, go to next level
            if (stepFails.Count <= 0)
            {
                levelComplete();
                return;
            }
            else
            {
                resetLevel();
                return;
            }
        }

        if (!hasSimulated)
        {
            audioSource.PlayOneShot(clickSound);
            for (int i = 0; i < inputGate.gate.NumInputs; i++)
            {
                inputGate.setOutput(BinaryUtility.getBit(step, i), i);
            }

            verifyOutput();
            hasSimulated = true;
        }

        else
        {
            step++;
            hasSimulated = false;
        }
    }