Beispiel #1
0
        private void OnButtonReset(SteppingButton button)
        {
            if (settings.resetAllWhenWrong)
            {
                nextCorrectOrder = 0;
            }

            button.ResetButton();
        }
Beispiel #2
0
        private void OnButtonPressed(SteppingButton button)
        {
            if (nextCorrectOrder >= buttons.Length)
            {
                return;
            }

            bool isCorrect = button.SteppingOrder == nextCorrectOrder;

            if (!isCorrect && settings.resetAllWhenWrong)
            {
                foreach (SteppingButton eachButton in buttons)
                {
                    eachButton.SetStatus(false);
                }
            }
            else
            {
                button.SetStatus(isCorrect);
            }

            audioSource.PlayOneShot(isCorrect ? settings.correctSound : settings.wrongSound);

            if (!isCorrect)
            {
                return;
            }

            nextCorrectOrder++;

            if (nextCorrectOrder < buttons.Length)
            {
                return;
            }

            audioSource.PlayOneShot(settings.solvedSound);
            onSolved.Invoke();
        }