Beispiel #1
0
        void OnTimesUp()
        {
            // Time's up!
            game.barSet.active = false;
            game.isTimesUp     = true;
            game.Context.GetOverlayWidget().OnClockCompleted();

            if (game.RemoveLife())
            {
                return;
            }

            // show time's up and back
            game.Context.GetPopupWidget().ShowTimeUp(
                () => {
                game.SetCurrentState(game.QuestionState);
                game.Context.GetPopupWidget().Hide();
            });
        }
Beispiel #2
0
        IEnumerator DoEndAnimation(bool correct, CircleButton correctButton)
        {
            box.Active = false;
            if (correct)
            {
                correctButton.SetColor(UnityEngine.Color.green);
            }
            else
            {
                correctButton.SetColor(UnityEngine.Color.red);
            }
            yield return(new UnityEngine.WaitForSeconds(1.0f));

            if (!correct && game.RemoveLife())
            {
                yield break;
            }

            game.circleBox.GetComponent <CircleButtonBox>().Clear(() => {
                game.SetCurrentState(game.QuestionState);
            }, 0.5f);
        }
Beispiel #3
0
        IEnumerator DoEndAnimation(bool correct, CircleButton correctButton, CircleButton clickedButton = null)
        {
            Finished   = true;
            box.Active = false;
            game.StartCoroutine(game.gameLettersHandler.CleanupCO(correct));
            if (countdownCo != null)
            {
                game.StopCoroutine(countdownCo);
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.ReadAndListen)
            {
                if (!TutorialMode)
                {
                    if (correct)
                    {
                        game.AddScore(1);
                    }
                }
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType != ReadingGameConfiguration.GameType.SimonSong)
            {
                yield return(new WaitForSeconds(1.0f));
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType != ReadingGameConfiguration.GameType.ReadAndListen)
            {
                if (!correct && game.RemoveLife())
                {
                    yield break;
                }
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.SimonSong)
            {
                // Time up
                if (!correct && !clickedButton)
                {
                    game.circleBox.GetComponent <CircleButtonBox>().ClearButtonsApartFrom(correctButton);
                }
                else
                {
                    if (correct)
                    {
                        game.AddScore(1);
                    }
                    else
                    {
                        clickedButton?.SetColor(Color.red);
                        yield return(new WaitForSeconds(0.5f));
                    }
                    correctButton.SetColor(Color.green);
                    game.circleBox.GetComponent <CircleButtonBox>().Clear(startDelay: 0.5f);
                }

                game.Context.GetAudioManager().PlayVocabularyData(correctButton.Answer);
                game.ChangeLoopingSong(game.CurrentSongBPM.intro);
                Debug.Log("POST ANSWER INTRO LOOP");
                game.onSongLoop += () =>
                {
                    KeeperManager.I.CloseSubtitles();
                    Debug.Log("END - POST ANSWER INTRO LOOP");
                    game.StopLoopingSong();
                    game.SetCurrentState(game.QuestionState);
                };
            }
            else if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.SimonSong)
            {
                game.circleBox.GetComponent <CircleButtonBox>().ClearButtonsApartFrom(correctButton);
                game.circleBox.GetComponent <CircleButtonBox>().Clear(() => {
                    game.SetCurrentState(game.QuestionState);
                }, 0.5f);
            }
            else
            {
                //if (!correct) clickedButton?.SetColor(Color.red);
                correctButton.SetColor(Color.green);
                game.circleBox.GetComponent <CircleButtonBox>().Clear(() => {
                    game.SetCurrentState(game.QuestionState);
                }, 0.5f);
            }
        }