예제 #1
0
        public void EnterState()
        {
            game.antura.AllowSitting = true;
            game.isTimesUp           = false;

            // Reset game timer
            gameTime.Reset(game.TimeToAnswer);

            switch (ReadingGameConfiguration.Instance.CurrentGameType)
            {
            case ReadingGameConfiguration.GameType.FollowReading:

                if (!TutorialMode)
                {
                    gameTime.Start();
                }
                else
                {
                    game.PlayTutorial();
                    drawTutorialLineTimer = 0;
                }

                break;

            case ReadingGameConfiguration.GameType.ReadAndListen:
                break;

            case ReadingGameConfiguration.GameType.FollowSong:
                break;

            case ReadingGameConfiguration.GameType.SimonSong:
                game.PlayTutorialConditional(TutorialMode, StartSimonQuestionLoop);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            var inputManager = game.Context.GetInputManager();

            inputManager.onPointerDown += OnPointerDown;
            inputManager.onPointerUp   += OnPointerUp;

            game.blurredText.SetActive(true);

            switch (ReadingGameConfiguration.Instance.CurrentGameType)
            {
            case ReadingGameConfiguration.GameType.FollowReading:

                break;

            case ReadingGameConfiguration.GameType.ReadAndListen:

                // Read it
                // Play the question word and go to the answer
                game.PlayTutorialConditional(TutorialMode,
                                             () =>
                                             game.Context.GetAudioManager().PlayVocabularyData(game.CurrentQuestion.GetQuestion(),
                                                                                               keeperMode: KeeperMode.LearningAndSubtitles, autoClose: false, callback:
                                                                                               () => {
                    // Setup timer for the new state
                    game.AnswerState.ReadTime     = gameTime.Time;
                    game.AnswerState.MaxTime      = gameTime.Duration;
                    game.AnswerState.TutorialMode = TutorialMode;
                    game.SetCurrentState(game.AnswerState);
                })
                                             );

                break;

            case ReadingGameConfiguration.GameType.FollowSong:
                AudioClip songAudio = null;
                switch (ReadingGameConfiguration.Instance.Variation)
                {
                case ReadingGameVariation.SongAlphabet:
                    songAudio = game.alphabetSongAudio;
                    break;

                case ReadingGameVariation.SongDiacritics:
                    songAudio = game.diacriticSongAudio;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                game.barSet.PlaySong(game.Context.GetAudioManager().PlaySound(songAudio), OnSongEnded);
                break;

            case ReadingGameConfiguration.GameType.SimonSong:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            completedDragging = false;

            if (firstRealRun)
            {
                bool showClock = ReadingGameConfiguration.Instance.ShowTimer;
                bool showLives = ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.FollowReading;

                if (!TutorialMode)
                {
                    // Configure overlay
                    var overlay = game.Context.GetOverlayWidget();
                    overlay.Initialize(true, showClock, showLives);
                    overlay.SetMaxLives(game.Lives);
                    overlay.SetLives(game.Lives);
                    overlay.SetClockDuration(gameTime.Duration);
                    overlay.SetClockTime(gameTime.Time);
                    overlay.SetStarsThresholds(game.GetStarsThreshold(1), game.GetStarsThreshold(2), game.GetStarsThreshold(3));
                    firstRealRun = false;
                }
            }

            switch (ReadingGameConfiguration.Instance.CurrentGameType)
            {
            case ReadingGameConfiguration.GameType.FollowReading:
                game.barSet.SwitchToNextBar();
                game.barSet.active = true;
                break;

            case ReadingGameConfiguration.GameType.FollowSong:
                game.barSet.active = true;
                break;

            case ReadingGameConfiguration.GameType.ReadAndListen:
            case ReadingGameConfiguration.GameType.SimonSong:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }