Пример #1
0
        void Next(bool correct, CircleButton clickedButton)
        {
            if (ReadingGameConfiguration.Instance.CurrentGameType != ReadingGameConfiguration.GameType.SimonSong)
            {
                KeeperManager.I.CloseSubtitles();
            }

            if (!TutorialMode)
            {
                game.Context.GetLogManager().OnAnswered(correctLLData, correct);
            }
            if (correct)
            {
                // Assign score
                if (!TutorialMode && showOldTimer)
                {
                    game.AddScore((int)(ReadTime) + 1);
                    game.radialWidget.percentage = 0;
                    game.radialWidget.pulsing    = false;
                }

                game.StartCoroutine(DoEndAnimation(true, correctButton, clickedButton));

                game.antura.Mood = ReadingGameAntura.AnturaMood.HAPPY;
            }
            else
            {
                if (TutorialMode)
                {
                    Finished = false;
                }
                else
                {
                    if (!TutorialMode && showOldTimer)
                    {
                        game.radialWidget.PoofAndHide();
                    }
                    game.StartCoroutine(DoEndAnimation(false, correctButton, clickedButton));

                    if (game.antura.isActiveAndEnabled)
                    {
                        game.antura.animator.DoShout(() => { ReadingGameConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.DogBarking); });
                    }
                }
            }
        }
Пример #2
0
        void OnAnswered(CircleButton button)
        {
            bool result = button.Answer == correct;

            game.Context.GetAudioManager().PlaySound(result ? Sfx.OK : Sfx.KO);

            if (!TutorialMode)
            {
                game.Context.GetLogManager().OnAnswered(correct, result);
            }
            if (button.Answer == correct)
            {
                // Assign score
                if (!TutorialMode)
                {
                    game.AddScore((int)(ReadTime) + 1);
                    game.radialWidget.percentage = 0;
                    game.radialWidget.pulsing    = false;
                }

                game.StartCoroutine(DoEndAnimation(true, correctButton));

                game.antura.Mood = ReadingGameAntura.AnturaMood.HAPPY;
            }
            else
            {
                if (TutorialMode)
                {
                    //button.SetColor(UnityEngine.Color.red);
                    if (box.IsReady())
                    {
                        TutorialUI.MarkNo(button.transform.position);
                    }
                }
                else
                {
                    if (!TutorialMode)
                    {
                        game.radialWidget.PoofAndHide();
                    }
                    game.StartCoroutine(DoEndAnimation(false, correctButton));

                    game.antura.animator.DoShout(() => { ReadingGameConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.DogBarking); });
                }
            }
        }
Пример #3
0
        public void Update(float delta)
        {
            if (!TutorialMode)
            {
                game.Context.GetOverlayWidget().SetClockTime(gameTime.Time);
            }
            else if (dragging == null)
            {
                drawTutorialLineTimer -= delta;

                if (drawTutorialLineTimer < 0)
                {
                    var activeBar = game.barSet.GetActiveBar();
                    if (activeBar != null)
                    {
                        drawTutorialLineTimer = 5;

                        var handleOffset = activeBar.glass.handleOffset.position - activeBar.glass.transform.position;
                        TutorialUI.DrawLine(activeBar.start.transform.position + handleOffset, activeBar.endCompleted.transform.position + handleOffset, TutorialUI.DrawLineMode.FingerAndArrow, false, true);
                    }
                }
            }

            gameTime.Update(delta);

            // Drag & Read
            if (dragging != null)
            {
                var  inputManager = game.Context.GetInputManager();
                bool applyMagnet  = ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.FollowReading;
                completedDragging = dragging.SetGlassScreenPosition(inputManager.LastPointerPosition + draggingOffset, applyMagnet);
            }
            else
            {
                if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.FollowReading)
                {
                    if (completedDragging)
                    {
                        var completedAllBars = game.barSet.SwitchToNextBar();

                        if (completedAllBars)
                        {
                            // go to Buttons State
                            game.AnswerState.ReadTime     = gameTime.Time;
                            game.AnswerState.MaxTime      = gameTime.Duration;
                            game.AnswerState.TutorialMode = TutorialMode;
                            game.SetCurrentState(game.AnswerState);
                            return;
                        }
                    }

                    completedDragging = false;
                }
            }

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

                float perc = gameTime.Time / gameTime.Duration;

                if (perc < 0.05f)
                {
                    game.antura.Mood = ReadingGameAntura.AnturaMood.SAD;
                }
                else if (perc < 0.5f)
                {
                    game.antura.Mood = ReadingGameAntura.AnturaMood.ANGRY;
                }
                else
                {
                    game.antura.Mood = ReadingGameAntura.AnturaMood.HAPPY;
                }
                break;

            case ReadingGameConfiguration.GameType.FollowSong:

                float distance;
                if (game.barSet.GetFollowingDistance(out distance))
                {
                    distance = Math.Abs(distance);

                    if (distance > 100)
                    {
                        timeFarFromTarget += delta;
                    }
                    else
                    {
                        timeFarFromTarget = 0;
                        //if (distance < 50) {
                        scoreAccumulator += 1.2f * delta;
                        //} else {
                        //    scoreAccumulator += 1 * delta;
                        // }
                        if (scoreAccumulator >= 1)
                        {
                            game.AddScore((int)scoreAccumulator);
                            scoreAccumulator = scoreAccumulator - (int)scoreAccumulator;
                            game.UpdateFollowDifficulty();
                        }
                    }

                    if (timeFarFromTarget > 1.0f)
                    {
                        game.antura.Mood = ReadingGameAntura.AnturaMood.ANGRY;
                    }
                    else
                    {
                        game.antura.Mood = ReadingGameAntura.AnturaMood.HAPPY;
                    }
                }

                break;

            case ReadingGameConfiguration.GameType.ReadAndListen:
                break;

            case ReadingGameConfiguration.GameType.SimonSong:
                break;
            }
        }