void Update() { float t = (game.CurrentScore / (float)game.GetStarsThreshold(3)); int mustBePopped = Mathf.Min(Mathf.RoundToInt(t * popCount), popCount); for (int i = popped; i < mustBePopped; ++i) { toPop[i].SetActive(true); ++popped; var puffGo = GameObject.Instantiate(poofPrefab); puffGo.AddComponent <AutoDestroy>().duration = 2; puffGo.SetActive(true); var toPopTransform = toPop[i].transform; var position = toPopTransform.position + toPopTransform.up * 5 + toPopTransform.forward * 2; puffGo.transform.position = position; puffGo.transform.localScale *= 5f; } }
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(); } }
public void EnterState() { game.antura.AllowSitting = true; game.isTimesUp = false; // Reset game timer gameTime.Reset(game.TimeToAnswer); if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer) { if (!TutorialMode) { gameTime.Start(); } else { game.Context.GetAudioManager().PlayDialogue(Database.LocalizationDataId.ReadingGame_Tuto); drawTutorialLineTimer = 0; } } var inputManager = game.Context.GetInputManager(); inputManager.onPointerDown += OnPointerDown; inputManager.onPointerUp += OnPointerUp; game.blurredText.SetActive(true); //game.circleBox.SetActive(false); if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.Alphabet) { game.barSet.PlaySong(game.Context.GetAudioManager().PlaySound(game.alphabetSongAudio), OnSongEnded); } else if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.DiacriticSong) { game.barSet.PlaySong(game.Context.GetAudioManager().PlaySound(game.diacriticSongAudio), OnSongEnded); } completedDragging = false; if (firstRealRun) { bool isSong = (ReadingGameConfiguration.Instance.Variation != ReadingGameVariation.ReadAndAnswer); if (!TutorialMode) { // Configure overlay var overlay = game.Context.GetOverlayWidget(); overlay.Initialize(true, !isSong, !isSong); 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; } } if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer) { game.barSet.SwitchToNextBar(); } game.barSet.active = true; }