Exemplo n.º 1
0
        IEnumerator DoDialogEnter(M8.TextMeshPro.TextMeshProTypewriter dialog, AnimatorEnterExit transition, string textRef)
        {
            transition.gameObject.SetActive(true);

            yield return(transition.PlayEnterWait());

            dialog.text = M8.Localize.Get(textRef);
            dialog.gameObject.SetActive(true);

            LoLManager.instance.StopSpeakQueue();
            LoLManager.instance.SpeakText(textRef);
        }
Exemplo n.º 2
0
        IEnumerator DoScoreEnter()
        {
            if (LoLManager.isInstantiated)
            {
                scoreCounter.SetCountImmediate(LoLManager.instance.curScore);
            }
            else
            {
                scoreCounter.SetCountImmediate(0);
            }

            scoreTransition.gameObject.SetActive(true);
            yield return(scoreTransition.PlayEnterWait());
        }
Exemplo n.º 3
0
    IEnumerator DoShow(GameObject go, GameObject postActiveGO, AnimatorEnterExit animatorEnterExit)
    {
        go.SetActive(true);

        if (animatorEnterExit)
        {
            while (animatorEnterExit.isPlaying)
            {
                yield return(null);
            }

            yield return(animatorEnterExit.PlayEnterWait());

            if (postActiveGO)
            {
                postActiveGO.SetActive(true);
            }
        }
    }
Exemplo n.º 4
0
    protected override IEnumerator Start()
    {
        yield return(base.Start());

        seqIllustrateFormula.gameObject.SetActive(true);
        yield return(seqIllustrateFormula.PlayEnterWait());

        seqDlgFormula.Play();
        while (seqDlgFormula.isPlaying)
        {
            yield return(null);
        }

        yield return(seqIllustrateFormula.PlayExitWait());

        seqIllustrateFormula.gameObject.SetActive(false);

        seqIllustrateAxis.gameObject.SetActive(true);
        yield return(seqIllustrateAxis.PlayEnterWait());

        seqDlgAxis.Play();
        while (seqDlgAxis.isPlaying)
        {
            yield return(null);
        }

        yield return(seqIllustrateAxis.PlayExitWait());

        seqIllustrateAxis.gameObject.SetActive(false);

        ApplyCurrentWheelInfoDisplay();
        cannonAnimator.Play(cannonTakeEnter);
        while (cannonAnimator.isPlaying)
        {
            yield return(null);
        }

        seqDlgKnightEnter.Play();
        while (seqDlgKnightEnter.isPlaying)
        {
            yield return(null);
        }

        cannonInterfaceGO.SetActive(true);

        yield return(new WaitForSeconds(0.34f));

        //enable cannon launch
        mIsKnightLocked = true;

        cannonLaunch.interactable = true;

        seqPressLaunch.gameObject.SetActive(true);
        seqPressLaunch.PlayEnter();

        //wait for launch
        mIsCannonballFree = true; //free shot
        mIsLaunchWait     = true;
        while (mIsLaunchWait)
        {
            yield return(null);
        }

        //wait for tracer to finish
        do
        {
            yield return(null);
        } while(graphControl.tracer.isRecording);


        //wheel time
        mCurWheelTracerMaxInd = graphControl.tracer.points.Count - 2;

        wheelTimeSlider.minValue = 0f;
        wheelTimeSlider.maxValue = mCurWheelTracerMaxInd;

        mCurWheelDialogInd = -1;
        ApplyWheelTime(0);

        wheelTimeGhost.SetActive(true);

        wheelTimeAnim.gameObject.SetActive(true);
        yield return(wheelTimeAnim.PlayEnterWait());

        mIsWheelTimeWaitNext = true; //wait for slider to get to end where next is show, wait for it to be pressed.
        while (mIsWheelTimeWaitNext)
        {
            yield return(null);
        }

        wheelTimeGhost.SetActive(false);

        yield return(wheelTimeAnim.PlayExitWait());

        wheelTimeAnim.gameObject.SetActive(false);

        nextGO.SetActive(false);
        //


        //graph stuff
        graphButton.interactable = true;

        seqPressGraph.gameObject.SetActive(true);
        seqPressGraph.PlayEnter();

        mIsGraphWait = true;
        while (mIsGraphWait)
        {
            yield return(null);
        }

        //dialog about graph
        yield return(new WaitForSeconds(0.34f));

        seqDlgGraph.Play();
        while (seqDlgGraph.isPlaying)
        {
            yield return(null);
        }

        //wait for graph to be closed
        while (graphControl.graphGO.activeSelf)
        {
            yield return(null);
        }
        //

        seqPressGraph.gameObject.SetActive(false);

        //show targets
        ShowTargets();

        yield return(new WaitForSeconds(1.5f));

        seqDlgPlay.Play();
        while (seqDlgPlay.isPlaying)
        {
            yield return(null);
        }
        //

        //ready to play normally
        mIsKnightLocked = false;

        ApplyCurrentWheelInfoDisplay();
        cannonAnimator.Play(cannonTakeEnter);
        while (cannonAnimator.isPlaying)
        {
            yield return(null);
        }

        cannonLaunch.interactable = true;
        forceSlider.interactable  = true;

        seqForceSlider.gameObject.SetActive(true);
        seqForceSlider.PlayEnter();
    }
Exemplo n.º 5
0
    protected override IEnumerator Start()
    {
        if (!string.IsNullOrEmpty(musicPath))
        {
            LoLManager.instance.PlaySound(musicPath, true, true);
        }

        yield return(base.Start());

        titleAnim.gameObject.SetActive(true);
        yield return(titleAnim.PlayEnterWait());

        yield return(new WaitForSeconds(startDelay));

        motionIllustrationAnim.gameObject.SetActive(true);
        yield return(motionIllustrationAnim.PlayEnterWait());

        introDialog.Play();
        while (introDialog.isPlaying)
        {
            yield return(null);
        }

        yield return(titleAnim.PlayExitWait());

        titleAnim.gameObject.SetActive(false);

        yield return(motionIllustrationAnim.PlayExitWait());

        motionIllustrationAnim.gameObject.SetActive(false);

        //princess
        yield return(DoPrincessDistress());

        //help
        kidnapDialog.Play();
        while (kidnapDialog.isPlaying)
        {
            yield return(null);
        }

        //get block 1 ready
        block1.gameObject.SetActive(true);
        block1.body.simulated = true;

        block1ForceGravityGO.SetActive(true);

        mBlockForceRout = StartCoroutine(DoForceBalance(block1, block1ForceNetGO, block1ForceBalancedGO, block1ForceUnbalancedGO, block1NetForceDirRoot, block1NetForceNoneGO));

        //wait a bit, then pause and describe the gravity
        yield return(new WaitForSeconds(gravityDialogWaitDelay));

        M8.SceneManager.instance.Pause();

        gravityDialog.Play();
        while (gravityDialog.isPlaying)
        {
            yield return(null);
        }

        M8.SceneManager.instance.Resume();

        //wait for block 1 to hit ground
        while (!block1.isGrounded)
        {
            yield return(null);
        }

        //fancy camera shake
        cameraShaker.Shake();

        if (!string.IsNullOrEmpty(blockLandSfxPath))
        {
            LoLManager.instance.PlaySound(blockLandSfxPath, false, false);
        }

        yield return(new WaitForSeconds(1f));

        for (int i = 0; i < block1Wheels.Length; i++)
        {
            var suspension = block1Wheels[i].suspension;
            suspension.frequency       = block1WheelsGroundFreq;
            block1Wheels[i].suspension = suspension;
        }
        //

        yield return(new WaitForSeconds(1f));

        block1ForceGravityGO.SetActive(false);

        //some more dialog
        landDialog.Play();
        while (landDialog.isPlaying)
        {
            yield return(null);
        }

        //show interaction
        interfaceRootGO.SetActive(true);

        //set to only one knight
        var knightSpawner   = (EntitySpawnerWidget)unitSpawnerWidget;
        var lastKnightCount = knightSpawner.entityCount;

        knightSpawner.SetEntityCount(1);

        //game ready
        unitSpawnerWidget.active = true;

        //drag instruction
        yield return(new WaitForSeconds(0.35f));

        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);

        while (knightSpawner.activeUnitCount == 0)
        {
            yield return(null);
        }

        mDragGuide.Hide();
        //

        //wait for block1 to start moving

        //send 1 goblin
        StartCoroutine(DoGoblins());

        //wait for block contact
        while ((block1.collisionFlags & CollisionFlags.CollidedSides) == CollisionFlags.None)
        {
            yield return(null);
        }

        //show knight force
        block1ForceKnightGO.SetActive(true);

        //wait for goblin force display
        while (!block1ForceGoblinGO.activeSelf)
        {
            yield return(null);
        }

        //dialog
        goblinPushDialog.Play();
        while (goblinPushDialog.isPlaying)
        {
            yield return(null);
        }

        //add the rest of knights counter
        knightSpawner.SetEntityCount(lastKnightCount);

        //show drag again
        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);
        mIsDragGuideShown = true;

        //wait for block1 to contact goal
        bool isBlockFinish = false;

        while (!isBlockFinish)
        {
            var blockContacts = block1.collisionData;
            for (int i = 0; i < blockContacts.Count; i++)
            {
                var coll = blockContacts[i].collider;
                if (coll && coll.CompareTag(block1GoalTag))
                {
                    isBlockFinish = true;
                    break;
                }
            }

            yield return(null);
        }

        unitSpawnerWidget.active = false;

        //animation

        //clear out units
        signalUnitsClear.Invoke();

        block1ForceKnightGO.SetActive(false);
        block1ForceGoblinGO.SetActive(false);

        //more dialog
        yield return(new WaitForSeconds(2f));

        //clear out block1 info
        StopCoroutine(mBlockForceRout);
        block1ForceNetGO.SetActive(false);
        block1ForceBalancedGO.SetActive(false);
        block1ForceUnbalancedGO.SetActive(false);
        block1NetForceDirRoot.gameObject.SetActive(false);
        block1NetForceNoneGO.SetActive(false);
        //

        block1FinishDialog.Play();
        while (block1FinishDialog.isPlaying)
        {
            yield return(null);
        }
        //

        //block 2 ready
        block2.gameObject.SetActive(true);
        block2.body.simulated = true;

        block2ForceGravityGO.SetActive(true);

        mBlockForceRout = StartCoroutine(DoForceBalance(block2, block2ForceNetGO, block2ForceBalancedGO, block2ForceUnbalancedGO, block2NetForceDirRoot, block2NetForceNoneGO));

        //wait for block 2 to hit ground
        while (!block2.isGrounded)
        {
            yield return(null);
        }

        //fancy camera shake
        cameraShaker.Shake();

        if (!string.IsNullOrEmpty(blockLandSfxPath))
        {
            LoLManager.instance.PlaySound(blockLandSfxPath, false, false);
        }

        block2ForceGravityGO.SetActive(false);

        block2Dialog.Play();
        while (block2Dialog.isPlaying)
        {
            yield return(null);
        }

        //game ready
        unitSpawnerWidget.active = true;

        //show drag again
        mDragGuide.Show(false, unitSpawnerWidget.icon.transform.position, dragGuideTo.position);
        mIsDragGuideShown = true;

        //wait for knight contact, then show forces
        while ((block2.collisionFlags & CollisionFlags.CollidedSides) == CollisionFlags.None)
        {
            yield return(null);
        }

        block2ForcesGO.SetActive(true);
        //

        //wait for block2 to contact block 1
        isBlockFinish = false;

        while (!isBlockFinish)
        {
            var blockContacts = block2.collisionData;
            for (int i = 0; i < blockContacts.Count; i++)
            {
                var coll = blockContacts[i].collider;
                if (coll == block1.coll)
                {
                    isBlockFinish = true;
                    break;
                }
            }

            yield return(null);
        }

        unitSpawnerWidget.active = false;

        //clear out units
        signalUnitsClear.Invoke();

        StopCoroutine(mBlockForceRout);
        block2ForcesGO.SetActive(false);
        block2ForceNetGO.SetActive(false);
        block2ForceBalancedGO.SetActive(false);
        block2ForceUnbalancedGO.SetActive(false);
        block2NetForceDirRoot.gameObject.SetActive(false);
        block2NetForceNoneGO.SetActive(false);

        //victory
        yield return(new WaitForSeconds(victoryStartDelay));

        victoryGO.SetActive(true);

        yield return(new WaitForSeconds(victoryDelay));

        //next level
        //GameData.instance.Progress();
        M8.UIModal.Manager.instance.ModalCloseAll();
        M8.UIModal.Manager.instance.ModalOpen(victoryModal);
    }
Exemplo n.º 6
0
    protected override IEnumerator Start()
    {
        if (!string.IsNullOrEmpty(musicPath))
        {
            LoLManager.instance.PlaySound(musicPath, true, true);
        }

        yield return(base.Start());

        //intro
        yield return(new WaitForSeconds(0.5f));

        introDialog.Play();
        while (introDialog.isPlaying)
        {
            yield return(null);
        }
        //

        //inertia
        inertiaIllustrationAnim.gameObject.SetActive(true);
        yield return(inertiaIllustrationAnim.PlayEnterWait());

        inertiaDialog.Play();
        while (inertiaDialog.isPlaying)
        {
            yield return(null);
        }

        yield return(inertiaIllustrationAnim.PlayExitWait());

        inertiaIllustrationAnim.gameObject.SetActive(false);
        //

        //illustrate
        illustrateGO.SetActive(true);

        illustrateDialog.Play();
        while (illustrateDialog.isPlaying)
        {
            yield return(null);
        }

        illustrateGO.SetActive(false);

        //show left side weight
        itemBody.gameObject.SetActive(true);

        yield return(new WaitForSeconds(treasureDialogStartDelay));

        treasureDialog.Play();
        while (treasureDialog.isPlaying)
        {
            yield return(null);
        }

        //enable play
        SetInteractiveEnabled(true);

        //drag instruction
        dragWeightHelpGO.SetActive(true);

        if (mDragGuide)
        {
            var     cam  = Camera.main;
            Vector2 sPos = cam.WorldToScreenPoint(dragWeightStartAnchor.position);
            Vector2 ePos = cam.WorldToScreenPoint(dragWeightEndAnchor.position);

            mDragGuide.Show(false, sPos, ePos);
            mIsDragGuideShown = true;
        }

        //SetInteractiveEnabled(false);

        //GameData.instance.Progress();
    }
Exemplo n.º 7
0
    IEnumerator DoScore()
    {
        //lock inputs, enabled clicks on placed
        for (int i = 0; i < mShapeCategoryWidgetActivePicks.Count; i++)
        {
            mShapeCategoryWidgetActivePicks[i].isDragEnabled = false;
        }

        for (int i = 0; i < mShapeCategoryWidgetActivePlaced.Count; i++)
        {
            mShapeCategoryWidgetActivePlaced[i].isDragEnabled  = false;
            mShapeCategoryWidgetActivePlaced[i].isClickEnabled = true;
        }

        //hide next
        yield return(nextBase.PlayExitWait());

        nextBase.gameObject.SetActive(false);

        //hide pick category
        yield return(categoryPickBase.PlayExitWait());

        categoryPickBase.gameObject.SetActive(false);

        //clear out picks
        ClearCategoryPicks();

        //ClearMeasureDisplays();

        bool showCategoryDetailInstruct = false;

        int correctCount = 0;
        int wrongCount   = 0;

        var wait = new WaitForSeconds(evaluateDelay);

        mShapeCategoriesPlaced.Clear();

        //evaluate placed categories
        for (int i = 0; i < mShapeCategoryWidgetActivePlaced.Count; i++)
        {
            var widget   = mShapeCategoryWidgetActivePlaced[i];
            var category = widget.data;

            //check if matched
            if (mShapeCategories.Exists(category))
            {
                widget.correctGO.SetActive(true);
                correctCount++;

                mShapeCategoriesPlaced.Add(category);

                M8.SoundPlaylist.instance.Play(sfxCorrect, false);
            }
            else
            {
                widget.errorGO.SetActive(true);
                wrongCount++;

                M8.SoundPlaylist.instance.Play(sfxWrong, false);

                showCategoryDetailInstruct = true;
            }

            yield return(wait);
        }

        //add missed categories
        for (int i = 0; i < mShapeCategories.Count; i++)
        {
            var category = mShapeCategories[i];
            if (!mShapeCategoriesPlaced.Exists(category))
            {
                if (mShapeCategoryWidgetCache.Count > 0)
                {
                    var widget = mShapeCategoryWidgetCache.RemoveLast();

                    widget.Setup(category);
                    widget.isClickEnabled = true;
                    widget.missGO.SetActive(true);

                    widget.transform.SetParent(categoryContainer, false);

                    mShapeCategoryWidgetActivePlaced.Add(widget);

                    M8.SoundPlaylist.instance.Play(sfxMiss, false);

                    showCategoryDetailInstruct = true;

                    yield return(wait);
                }
            }
        }

        if (showCategoryDetailInstruct)
        {
            categoryInstructGO.SetActive(true);
        }

        //compute score
        float score = Mathf.Clamp01((float)correctCount / mShapeCategories.Count) * GameData.instance.scoreShape;

        score -= wrongCount * GameData.instance.scorePenalty;
        if (score < 0f)
        {
            score = 0f;
        }

        if (mShapeProfile)
        {
            mShapeProfile.score = Mathf.RoundToInt(score);

            scoreCounter.count = mShapeProfile.score;
        }

        M8.SoundPlaylist.instance.Play(sfxEnter, false);

        //show score
        scoreBase.gameObject.SetActive(true);
        yield return(scoreBase.PlayEnterWait());

        //show next
        nextBase.gameObject.SetActive(true);
        nextBase.PlayEnter();

        mRout = null;
    }