new void Update()
    {
        /*if (meditationStatus == MeditationStatus.meditating)
         * {
         *      elapsedTime += Time.deltaTime;
         *      if (tParam > 1.0f)
         *              meditationStatus = MeditationStatus.meditated;
         *      player.ascend ();
         * }*/

        if (meditationState == MeditationState.waitingForChispa)
        {
            if (dark)
            {
                player.meditate();
                level.musicFadeOut(5.0f);
                meditationState = MeditationState.meditating;
                fruit._wa_grow(this, timeToCompletion);
            }
            else
            {
                if (effectProgram != null)
                {
                    if (effectProgram.isProgramRunning [0])                     // wait for chispa
                    {
                        return;
                    }
                }

                fruit._wa_grow(this, timeToCompletion);
                breather.activate();
                player.meditate();
                level.musicFadeOut(10.0f);
                meditationState = MeditationState.meditating;
            }
        }

        if (meditationState == MeditationState.meditating)
        {
            if (isWaitingForActionToComplete)
            {
                return;
            }

            player.ascend();
            level.musicFadeIn();
            meditationState = MeditationState.meditated;
        }

        if (meditationState == MeditationState.meditated)
        {
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        float ySize;


        /* slot 1 */
        if (state2 == 0)           // idle

        {
        }
        if (state2 == 1)           // delay
        {
            slot1elapsedTime += Time.deltaTime;
            if (slot1elapsedTime > looseScreenDelay)
            {
                ++state2;
            }
        }
        if (state2 == 2)
        {
            level.loadScene("LevelOver");
        }
        /* end of slot 1 */



        /* slot 0 */
        if ((globalStep == 0) && (state2 == 0))
        {
            state2 = 1;
            level.musicFadeOut();
            fader.fadeOut();
        }
        if (state == LetterState.idle)           // We set target1col&target2op Here
        {
            if (globalStep < globalTargetStep)   // need to go UP!

            {
                if (step == (substeps - 1))
                {
                    setColorOpacityTargets(0);
                    opacity = 1.0f;
                    state   = LetterState.fadingOutScrollingUp;
                }
                else
                {
                    setColorOpacityTargets(step + 1);
                    state = LetterState.steppingUp;
                }
            }
            else if (globalStep > globalTargetStep)                 // need to go DOWN!

            {
                if (step == 0)
                {
                    setColorOpacityTargets(substeps - 1);
                    opacity = 1.0f;
                    state   = LetterState.fadingOutScrollingDown;
                }
                else
                {
                    setColorOpacityTargets(step - 1);
                    state = LetterState.steppingDown;
                }
            }
            else
            {
                if (idleElapsedTime < idleMaxTime)
                {
                    idleElapsedTime += Time.deltaTime;
                    if (idleElapsedTime > idleMaxTime)
                    {
                        targetGlobalOpacity = 0.0f;
                    }
                }
            }
        }


        if (state == LetterState.fadingInScrollingDown)           // when a letter disappears and the next
        // appears

        {
            opacity += opacitySpeed * Time.deltaTime;
            if (opacity > 1.0f)
            {
                --globalStep;
                step    = getStep(globalStep);
                state   = LetterState.idle;
                opacity = 1.0f;
            }

            //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity;
            letter2opacity = opacity;
        }

        if (state == LetterState.fadingOutScrollingDown)
        {
            opacity -= opacitySpeed * Time.deltaTime;
            if (opacity < 0.0f)
            {
                state = LetterState.fadingInScrollingDown;
                --letterNum;
                opacity         = 0.0f;
                letter1.color   = new Color(1.0f, 1.0f, 1.0f, opacity);
                letter2.color   = new Color(1.0f, 1.0f, 1.0f, opacity);
                letter1.texture = letter [letterNum];                 // change letter
                letter2.texture = litLetter [letterNum];
            }
            float percent = (1.0f / (substeps / 2));
            //letter1.color = new Color (percent, percent, percent, opacity);
            ////letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity * percent;
            letter2opacity = 0.0f;
        }

        if (state == LetterState.fadingInScrollingUp)           // when a letter disappears and the next
        // appears

        {
            opacity += opacitySpeed * Time.deltaTime;
            if (opacity > 1.0f)
            {
                ++globalStep;
                step  = getStep(globalStep);
                state = LetterState.idle;
            }
            float percent = (1.0f / ((float)substeps / 2.0f));
            letter1color   = percent;
            letter2opacity = 0.0f;
            //letter1.color = new Color (percent, percent, percent, opacity);
            //letter2.color = new Color (0, 0, 0, 0);
        }

        if (state == LetterState.fadingOutScrollingUp)
        {
            opacity -= opacitySpeed * Time.deltaTime;
            if (opacity < 0.0f)
            {
                state = LetterState.fadingInScrollingUp;
                ++letterNum;
                opacity = 0.0f;
                //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
                //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
                letter1.texture = letter [letterNum];                 // change letter
                letter2.texture = litLetter [letterNum];
            }
            //letter1.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            //letter2.color = new Color (1.0f, 1.0f, 1.0f, opacity);
            letter1color   = opacity;
            letter2opacity = opacity;
        }

        if (state == LetterState.steppingUp)
        {
            if (letter1color < targetColor)
            {
                letter1color += changeSpeed * Time.deltaTime;
                if (letter1color > targetColor)
                {
                    letter1color = targetColor;
                    ++globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
            if (letter2opacity < targetOpacity)
            {
                letter2opacity += changeSpeed * Time.deltaTime;
                if (letter2opacity > targetOpacity)
                {
                    letter2opacity = targetOpacity;
                    ++globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
        }

        if (state == LetterState.steppingDown)
        {
            if (letter1color > targetColor)
            {
                letter1color -= changeSpeed * Time.deltaTime;
                if (letter1color < targetColor)
                {
                    letter1color = targetColor;
                    --globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
            if (letter2opacity > targetOpacity)
            {
                letter2opacity -= changeSpeed * Time.deltaTime;
                if (letter2opacity < targetOpacity)
                {
                    letter2opacity = targetOpacity;
                    --globalStep;
                    step  = getStep(globalStep);
                    state = LetterState.idle;
                }
            }
        }

        letter1.color = new Color(letter1color, letter1color, letter1color, letter1color * globalOpacity);
        letter2.color = new Color(1, 1, 1, letter2opacity * globalOpacity);
        frame.color   = new Color(1, 1, 1, globalOpacity);

        if (globalOpacity < targetGlobalOpacity)
        {
            globalOpacity += opacitySpeed * 2.0f * Time.deltaTime;
            if (globalOpacity > targetGlobalOpacity)
            {
                globalOpacity = targetGlobalOpacity;
            }
        }
        if (globalOpacity > targetGlobalOpacity)
        {
            globalOpacity -= opacitySpeed * 2.0f * Time.deltaTime;
            if (globalOpacity < targetGlobalOpacity)
            {
                globalOpacity = targetGlobalOpacity;
            }
        }
        /* end of slot 0 */
    }