public void ShowTutorial()
        {
            if (state != State.NonInteractive)
            {
                if (droppedZone == null || droppedZone != correctDropZone)
                {
                    TutorialUI.DrawLine(transform.position, correctDropZone.transform.position, TutorialUI.DrawLineMode.FingerAndArrow);
                }

                else if ((transform.rotation.z) > 0.1f)
                {
                    Vector3 rotateButtonPosition = droppedZone.rotateButtonController.transform.position;
                    TutorialUI.Click(new Vector3(rotateButtonPosition.x, rotateButtonPosition.y, rotateButtonPosition.z - 1f));
                }
            }
        }
Пример #2
0
        private void StartDrawDragLineFrom(Transform fromTr)
        {
            TutorialUI.Clear(false);

            Vector3[] path = new Vector3[3];
            path[0]   = fromTr.position;
            path[1]   = path[0] + Vector3.up * 4 + Vector3.left * 2;
            path[2]   = m_oCameraUI.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2));
            path[2].z = path[1].z;

            dragLineAnimation = TutorialUI.DrawLine(path, TutorialUI.DrawLineMode.Finger);
            dragLineAnimation.MainTween.timeScale = 0.8f;
            dragLineAnimation.OnComplete(delegate {
                StartDrawDragLineFrom(fromTr);
            });
        }
Пример #3
0
        IEnumerator coDoTutorial()
        {
            yield return(new WaitForSeconds(startDelay));

            resetTut(null, null);
            onTutorialStart();



            while (isTutRound)
            {
                if (pauseTut())
                {
                    yield return(null);

                    continue;
                }

                if (TUT_STEP == 1)
                {
                    //Debug.Log(llCounter+"<<<");
                    target = getNewTarget();
                    if (target)
                    {
                        TutorialUI.DrawLine(source.position - Vector3.forward * 2, target.position +
                                            new Vector3(0, scannerDevice.position.y - target.position.y, -2),
                                            TutorialUI.DrawLineMode.FingerAndArrow);
                    }
                    else
                    {
                        TutorialUI.Clear(true);
                    }
                }
                else
                {
                    //Debug.Log(Time.deltaTime + " b");
                    TutorialUI.DrawLine(source.position - Vector3.forward * 2, target.transform.position +
                                        new Vector3(5f, 3, -2), TutorialUI.DrawLineMode.FingerAndArrow);
                }

                yield return(new WaitForSeconds(repeatDelay));
            }

            onTutorialEnd();
        }
        void Update_Dragging()
        {
            if (Input.GetMouseButtonDown(0))
            {
                isDragging = true;
                storedPs.Add(MouseWorldPosition());
            }
            else if (isDragging)
            {
                Vector3 p = MouseWorldPosition();
                if (Vector3.Distance(storedPs[storedPs.Count - 1], p) >= MinPointDistance)
                {
                    storedPs.Add(p);
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                isDragging = false;
                if (storedPs.Count > 1)
                {
                    storedPs.RemoveAt(storedPs.Count - 1);
                }
                storedPs.Add(MouseWorldPosition());
                TutorialUI.DrawLineMode mode =
                    FingerToggle.isOn ? ArrowToggle.isOn ? TutorialUI.DrawLineMode.FingerAndArrow : TutorialUI.DrawLineMode.Finger
                    : ArrowToggle.isOn ? FingerToggle.isOn ? TutorialUI.DrawLineMode.FingerAndArrow : TutorialUI.DrawLineMode.Arrow
                    : TutorialUI.DrawLineMode.LineOnly;
                switch (drawMode)
                {
                case DrawMode.StraightLine:
                    TutorialUI.DrawLine(storedPs[0], storedPs[storedPs.Count - 1], mode, PersistentToggle.isOn, OverlayToggle.isOn)
                    .OnComplete(() => Debug.Log("DrawLine Complete"));
                    break;

                case DrawMode.FullCurve:
                    TutorialUI.DrawLine(storedPs.ToArray(), mode, PersistentToggle.isOn, OverlayToggle.isOn)
                    .OnComplete(() => Debug.Log("DrawLine Complete"));
                    break;
                }
                storedPs.Clear();
            }
        }
        IEnumerator coDoTutorial(Transform start = null)
        {
            yield return(new WaitForSeconds(tutorialStartDelay));

            onTutStart();

            while (game.roundsCount <= 0)
            {
                /*if (game.roundsCount > 0)
                 * {
                 *  TutorialUI.Clear(true);
                 *  break;
                 * }*/

                repeatConter++;
                TutorialUI.DrawLine(path, TutorialUI.DrawLineMode.FingerAndArrow);
                yield return(new WaitForSeconds(repeatDely));
            }

            onTutEnd();
        }
Пример #6
0
        private IEnumerator ShowTutorialUI_Coroutine()
        {
            yield return(new WaitForSeconds(uiDelay + 0.5f));

            while (isTutorialRound)
            {
                for (int i = 0; i < letterPicker.CorrectLetterChoices.Count; i++)
                {
                    var choice = letterPicker.CorrectLetterChoices[i];

                    if (choice.isCorrectChoice && !choice.IsDisabled && !letterPicker.IsBlocked)
                    {
                        var from = choice.transform.position;
                        var to   = dropZone.transform.position;
                        TutorialUI.SetCamera(uiCamera);
                        TutorialUI.DrawLine(from, to, TutorialUI.DrawLineMode.Finger, false, false);
                    }
                }
                yield return(new WaitForSeconds(2f));
            }
        }
Пример #7
0
        void Start()
        {
            if (ScannerConfiguration.Instance.Variation == ScannerVariation.OneWord || isTutRound)
            {
                startDelay = 8;
            }
            else if (ScannerConfiguration.Instance.nCorrect == 3)
            {
                startDelay = 25;
            }
            else if (ScannerConfiguration.Instance.nCorrect == 4)
            {
                startDelay = 24;
            }
            else
            {
                startDelay = 25.5f;
            }

            StartCoroutine(coDoTutorial());
            originalLLOnBeltSpeed = game.beltSpeed;
            //if (ScannerConfiguration.Instance.Difficulty >= 0.5f)
            game.beltSpeed = 2;


            game.disableInput = true;
            //warm up
            TutorialUI.DrawLine(-100 * Vector3.up, -100 * Vector3.up, TutorialUI.DrawLineMode.Arrow);

            scannerStartZPos = scannerDevice.transform.position.z;

            foreach (ScannerSuitcase sc in game.suitcases)
            {
                sc.onCorrectDrop += resetTut;
            }

            antura = game.antura.GetComponent <ScannerAntura>();
            //foreach (ScannerLivingLetter ll in game.scannerLL)
            //  ll.facingCamera = true;
        }
Пример #8
0
        IEnumerator coDoTutorial()
        {
            yield return(new WaitForSeconds(startDelay));

            StartCoroutine(sayTut(repeatDelay));

            while (gameManager.isTutRound)
            {
                if (currentDD)
                {
                    yield return(new WaitForSeconds(repeatDelay));


                    if (currentDD.isDragging || !gameManager.isTutRound)
                    {
                        yield return(null);

                        continue;
                    }

                    if (doTutOnDots)
                    {
                        targetPosition = hintDot.transform.TransformPoint(Vector3.Lerp(hintDot.mesh.vertices[0], hintDot.mesh.vertices[2], 0.5f));
                    }
                    else
                    {
                        targetPosition = target.position;
                    }

                    TutorialUI.DrawLine(source.position - Vector3.forward * 2, targetPosition - Vector3.forward * 2, TutorialUI.DrawLineMode.FingerAndArrow);

                    //yield return new WaitForSeconds(repeatDelay/2);
                }

                yield return(null);
            }
        }
Пример #9
0
        public void EnterState()
        {
            game.antura.AllowSitting = true;
            game.isTimesUp           = false;

            int maxQuestions = ReadingGameGame.MAX_QUESTIONS;

            switch (ReadingGameConfiguration.Instance.CurrentGameType)
            {
            case ReadingGameConfiguration.GameType.SimonSong:
                maxQuestions = ReadingGameGame.MAX_QUESTIONS_SIMON_SONG;
                break;
            }

            if (game.CurrentQuestionNumber >= maxQuestions)
            {
                game.EndGame(game.CurrentStars, game.CurrentScore);
                return;
            }

            game.blurredText.SetActive(true);

            switch (ReadingGameConfiguration.Instance.CurrentGameType)
            {
            case ReadingGameConfiguration.GameType.FollowReading:
            {
                // Pick a question and show it
                var pack = ReadingGameConfiguration.Instance.Questions.GetNextQuestion();
                game.CurrentQuestion = pack;

                if (pack != null)
                {
                    // Show the bar
                    game.barSet.SetData(pack.GetQuestion());
                }
                else
                {
                    game.EndGame(game.CurrentStars, game.CurrentScore);
                }

                break;
            }

            case ReadingGameConfiguration.GameType.ReadAndListen:
            {
                // Pick a question pack
                var pack = ReadingGameConfiguration.Instance.Questions.GetNextQuestion();
                game.CurrentQuestion = pack;
                break;
            }

            case ReadingGameConfiguration.GameType.FollowSong:

                // Just follow the bars
                game.UpdateFollowDifficulty();
                game.barSet.SetData(game.songToPlay);
                break;

            case ReadingGameConfiguration.GameType.SimonSong:
            {
                // Pick a question pack
                var pack = ReadingGameConfiguration.Instance.Questions.GetNextQuestion();
                game.CurrentQuestion = pack;
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            game.barSet.active = false;

            if (firstRun)
            {
                switch (ReadingGameConfiguration.Instance.CurrentGameType)
                {
                case ReadingGameConfiguration.GameType.FollowReading:
                case ReadingGameConfiguration.GameType.ReadAndListen:
                    game.PlayIntro(() => { completed = true; });
                    game.ReadState.TutorialMode = game.TutorialEnabled;
                    break;

                case ReadingGameConfiguration.GameType.SimonSong:
                    game.PlayIntro(() => { completed = true; });
                    game.ReadState.TutorialMode = game.TutorialEnabled;
                    break;

                case ReadingGameConfiguration.GameType.FollowSong:

                    game.PlayIntro(() => {
                        var firstBar     = game.barSet.GetNextBar();
                        var handleOffset = firstBar.glass.handleOffset.position - firstBar.glass.transform.position;

                        if (game.TutorialEnabled)
                        {
                            TutorialUI.DrawLine(firstBar.start.transform.position + handleOffset, firstBar.endCompleted.transform.position + handleOffset, TutorialUI.DrawLineMode.FingerAndArrow, false, true);
                        }
                        game.barSet.SwitchToNextBar();

                        if (game.TutorialEnabled)
                        {
                            UnityEngine.Debug.LogError("TUTORIAL ON");
                            game.Context.GetAudioManager()
                            .PlayDialogue(ReadingGameConfiguration.Instance.TutorialLocalizationId, () => {
                                completed = true;
                            });
                        }
                        else
                        {
                            completed = true;
                        }
                    });
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            else
            {
                ++game.CurrentQuestionNumber;
                completed = true;
                game.ReadState.TutorialMode = false;
            }

            if (ReadingGameConfiguration.Instance.ShowTimer && !game.ReadState.TutorialMode)
            {
                game.Context.GetOverlayWidget().SetClockDuration(game.TimeToAnswer);
                game.Context.GetOverlayWidget().SetClockTime(game.TimeToAnswer);
            }

            firstRun = false;
        }
Пример #10
0
        public void EnterState()
        {
            game.antura.AllowSitting = true;
            game.isTimesUp           = false;

            if (game.CurrentQuestionNumber >= ReadingGameGame.MAX_QUESTIONS)
            {
                game.EndGame(game.CurrentStars, game.CurrentScore);
                return;
            }

            if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer)
            {
                game.Context.GetOverlayWidget().SetClockDuration(game.TimeToAnswer);
                game.Context.GetOverlayWidget().SetClockTime(game.TimeToAnswer);
            }

            game.blurredText.SetActive(true);
            //game.circleBox.SetActive(false);

            if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer)
            {
                // Pick a question
                var pack = ReadingGameConfiguration.Instance.Questions.GetNextQuestion();
                game.CurrentQuestion = pack;
                if (pack != null)
                {
                    game.barSet.SetData(pack.GetQuestion());
                }
                else
                {
                    game.EndGame(game.CurrentStars, game.CurrentScore);
                }
            }
            else
            {
                game.barSet.SetShowTargets(ReadingGameConfiguration.Instance.Difficulty < 0.5f);
                game.barSet.SetShowArrows(ReadingGameConfiguration.Instance.Difficulty < 0.8f);

                game.barSet.SetData(game.songToPlay);
            }

            game.barSet.active = false;

            if (firstRun)
            {
                if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer)
                {
                    game.Context.GetAudioManager().PlayDialogue(Database.LocalizationDataId.ReadingGame_Intro, () => { completed = true; });
                    game.ReadState.TutorialMode = true;
                }
                else
                {
                    var introDialogue = ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.Alphabet ?
                                        Database.LocalizationDataId.Song_alphabet_Intro : Database.LocalizationDataId.AlphabetSong_letters_Intro;

                    game.Context.GetAudioManager().PlayDialogue(introDialogue, () => {
                        var firstBar     = game.barSet.GetNextBar();
                        var handleOffset = firstBar.glass.handleOffset.position - firstBar.glass.transform.position;

                        if (game.TutorialEnabled)
                        {
                            TutorialUI.DrawLine(firstBar.start.transform.position + handleOffset, firstBar.endCompleted.transform.position + handleOffset, TutorialUI.DrawLineMode.FingerAndArrow, false, true);
                        }
                        game.barSet.SwitchToNextBar();

                        if (game.TutorialEnabled)
                        {
                            game.Context.GetAudioManager()
                            .PlayDialogue(Database.LocalizationDataId.Song_alphabet_Tuto, () => {
                                completed = true;
                            });
                        }
                        else
                        {
                            completed = true;
                        }
                    });
                }
            }
            else
            {
                ++game.CurrentQuestionNumber;
                completed = true;
                game.ReadState.TutorialMode = false;
            }

            firstRun = false;
        }
Пример #11
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;
            }
        }
 private void showTutorial()
 {
     TutorialUI.Clear(false);
     TutorialUI.DrawLine(this.game.currentLetter.transform.position - new Vector3(0, -2.5f, 0), tube.cubeInfo.transform.position - Vector3.forward * 1.5f, TutorialUI.DrawLineMode.FingerAndArrow, false, true);
 }
        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;
                        TutorialUI.DrawLine(activeBar.start.transform.position, activeBar.endCompleted.transform.position, TutorialUI.DrawLineMode.FingerAndArrow, false, true);
                    }
                }
            }

            if (!hurryUpSfx)
            {
                if (gameTime.Time < 4f)
                {
                    hurryUpSfx = true;

                    timesUpAudioSource = game.Context.GetAudioManager().PlaySound(Sfx.DangerClockLong);
                }
            }

            gameTime.Update(delta);

            if (dragging != null)
            {
                var inputManager = game.Context.GetInputManager();
                completedDragging = dragging.SetGlassScreenPosition(inputManager.LastPointerPosition + draggingOffset,
                                                                    ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer);
            }
            else
            {
                if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer)
                {
                    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;
                }
            }


            if (ReadingGameConfiguration.Instance.Variation == ReadingGameVariation.ReadAndAnswer)
            {
                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;
                }
            }
            else // Alphabet Song
            {
                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.15f * delta;
                        }
                        else
                        {
                            scoreAccumulator += 1 * delta;
                        }

                        if (scoreAccumulator >= 1)
                        {
                            game.AddScore((int)scoreAccumulator);
                            scoreAccumulator = scoreAccumulator - (int)scoreAccumulator;
                        }
                    }

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