// Fade transition from plain egg to scene egg.
    // void FadeToSceneEgg() {
    //  // At which point after the egg starts falling does the SceneEgg start fading in over the plain egg.
    //  fadeSceneEggTimer += Time.deltaTime;
    //  if (fadeSceneEggTimer >= fadeSceneEggTime) {
    //      sceneEggFadeScript.FadeIn();
    //      thisEggFadeScript.FadeOut();
    //      fadeToSceneEgg = false;
    //  }
    //  // Start the egg trail FX
    //  trailPartSys.Play();
    // }

    // White flash transition from plain egg to scene egg.
    void FadeToSceneEgg()
    {
        // At which point after the egg starts falling does the egg flash white.
        fadeSceneEggTimer += Time.deltaTime;
        if (fadeSceneEggTimer >= flashEggTime && !eggFlashed)
        {
            spriteColorFadeScript.FlashIn();
            eggFlashed = true;
        }
        if (fadeSceneEggTimer >= spriteColorFadeScript.flashInDur + spriteColorFadeScript.autoFlashOutDelay + flashEggTime && !eggBurst)
        {
            sceneEggFadeScript.ResetAlpha(1f);
            // Move and play the egg transform FX.
            burstPartSys.transform.position = this.transform.position;
            burstPartSys.Play();
            // AUDIO - PLAIN EGG BECOMES SCENE EGG (Particle effects included)!

            //AUDIO - EGG transforming
            audioIntroScript.introEggPopTransformSFX();

            eggBurst = true;
            // Start the egg trail FX.
            trailPartSys.Play();
        }
        if (fadeSceneEggTimer >= spriteColorFadeScript.flashInDur + spriteColorFadeScript.autoFlashOutDelay + spriteColorFadeScript.flashOutDur + flashEggTime)
        {
            thisEggFadeScript.ResetAlpha(0f);
            fadeSceneEggTimer = 0f;
            fadeToSceneEgg    = false;
            eggFlashed        = false;
            //fallOffScreen = true;
            hoverBeforeFall = true;
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (activeClam && !activeSprite)
        {
            currentTime += Time.deltaTime;
            if (currentTime > lifeTimedelay)
            {
                myFade.ResetAlpha(0);
                mySprite.enabled = true;
                activeSprite     = true;
                myFade.FadeIn();
                //bubbles sounds ..
                audioBeachPuzzleScript = GameObject.Find("Audio").GetComponent <AudioSceneBeachPuzzle>();
                audioBeachPuzzleScript.BubblePopSFX();
            }
        }
        if (activeSprite)
        {
            currentTime += Time.deltaTime;
            if (currentTime < (lifeTime + lifeTimedelay) && currentTime > lifeTimedelay)
            {
                float   yPos   = gameObject.transform.localPosition.y + (Time.deltaTime * Speed);
                float   xPos   = curveTrail.Evaluate(currentTime + lifeTimedelay) * curveMultiplier;
                Vector3 newPos = new Vector3(xPos, yPos, gameObject.transform.localPosition.z);
                gameObject.transform.localPosition = newPos;
            }
            else
            {
                if (!fadeInOutSprite)
                {
                    myFade.FadeOut();
                    fadeInOutSprite = true;
                }
                currentTime = 0;

                bubblePopFX.transform.position = this.transform.position;
                var bubMain = bubblePopFX.main;
                bubMain.startSize = bubbleSize + 0.2f;
                bubblePopFX.Play();

                mySprite.enabled = false;
                gameObject.transform.localPosition = StartPosition;
                activeSprite = false;
                activeClam   = false;
            }
        }
    }