Example #1
0
 // Make first bag appear.
 public void MakeCurrentBagAppear()
 {
     GetCurrentReferences();
     curEggbagFadeScript.gameObject.SetActive(true);
     curEggbagFadeScript.FadeIn();
     bagAnim.SetTrigger("ComeIn");
     curGlowFadeScript.gameObject.SetActive(true);
     curGlowFadeScript.maxAlpha     = 0.2f;
     curGlowFadeScript.fadeDuration = 1f;
     curGlowFadeScript.FadeIn();
 }
    void TimeMovesIn()
    {
        if (normTimeFadeScript.hidden)
        {
            normTimeFadeScript.FadeIn();
        }
        lerpValue += Time.deltaTime / moveInDuration;
        float moveInNewX = Mathf.Lerp(startPos.x, endTrans.position.x, moveInXAnimCurve.Evaluate(lerpValue));
        float moveInNewY = Mathf.Lerp(startPos.y, endTrans.position.y, moveInYAnimCurve.Evaluate(lerpValue));

        currentTime.transform.position = new Vector3(moveInNewX, moveInNewY, currentTime.transform.position.z);
        //currentTime.transform.position = Vector3.Lerp(startPos, endTrans.position, moveInAnimCurve.Evaluate(lerpValue));
        newScale = Mathf.Lerp(startScale, endScale, scaleInAnimCurve.Evaluate(lerpValue));
        currentTime.transform.localScale = new Vector3(newScale, newScale, newScale);

        if (lerpValue >= 1f && !hoverUp)
        {
            timeHovers    = true;
            timePos       = endTrans.transform.position;
            botY          = currentTime.transform.localPosition.y;
            topY          = topYTrans.localPosition.y;
            newXMagnitude = Random.Range(newXMagMin, newXMagMax);
        }
        if (lerpValue >= 1)
        {
            lerpValue   = 0;
            timeMovesIn = false;
        }
    }
Example #3
0
    void GoToMenu()
    {
        //Debug.Log("Presssing Back To Menu Button");

        // - TO TURN OFF IMMEDIATELY - //
        foreach (GameObject levelButton in levelButtons)
        {
            levelButton.SetActive(false);
        }

        backToMenuBtn.enabled = false;

        // - MAKE THE CLOUDS CLOSE - //
        foreach (MoveCloud cloud in cloudsToMove)
        {
            cloud.moveIn = true;
        }

        // - FADE OUT BACKTOMENU BTN - //
        backToMenuFadeScript.FadeOut();

        // - FADE IN TITLE - //
        titleFade.FadeIn();

        // - FADE IN SOLID BACKGROUND - //
        solidBGFade.FadeIn();

        // - FADE IN ALL BUTTONS - //
        fadeBtnIn = true;
    }
 public void StartCurrentBagGlow()
 {
     levelsCompleted = GlobalVariables.globVarScript.levelsCompleted;
     curGlowScript   = bagGlowsScripts[levelsCompleted];
     curGlowScript.gameObject.SetActive(true);
     curGlowScript.FadeIn();
 }
Example #5
0
 public void ShowNextIcon()
 {
     nextIconFadeScript.FadeIn();
     nextIconTrans.localScale = new Vector3(minScale, minScale, minScale);
     scaling     = true;
     scaleDown   = false;
     scaleUp     = true;
     startScale  = minScale;
     targetScale = maxScale;
 }
Example #6
0
 void Update()
 {
     if (sendToPanel)
     {
         spawnDelay -= Time.deltaTime;
         if (spawnDelay <= 0)
         {
             if (!silEggAdded)
             {
                 //Debug.Log("Pssst, over here!" + posInPanel);
                 AddToSceneSilEgg();
                 GlobalVariables.globVarScript.SaveEggState();
                 //clickOnEggsScript.AdjustSilverEggCount();
                 clickOnEggsScript.AddEggsFound();
                 silEggAdded = true;
             }
             if (!trailFX.isPlaying)
             {
                 audioSceneGenScript.silverEggsPanel(this.gameObject);
                 trailFX.Play(true);
                 burstFX.Play(true);
             }
             lerpTimer += Time.deltaTime / moveDuration;
             this.transform.localScale = Vector3.Lerp(iniScale, iniScale * moveWithCamScript.newScale, lerpTimer);
             this.transform.position   = Vector3.Lerp(iniPos, clickOnEggsScript.silverEggsInPanel[posInPanel].transform.position, animCurve.Evaluate(lerpTimer));
             //Debug.Log("A Silver egg moves from puzz to pan! Dun dun duuuunnnn");
             if (lerpTimer >= 1)
             {
                 this.transform.position = clickOnEggsScript.silverEggsInPanel[posInPanel].transform.position;
                 clickOnEggsScript.eggMoving--;                     // if egg pos = panel pos
                 sendToPanel               = false;
                 this.transform.parent     = clickOnEggsScript.silverEggsInPanel[posInPanel].transform.parent;
                 this.transform.localScale = iniScale;
                 clickOnEggsScript.silverEggsFound++;
                 clickOnEggsScript.AddEggsFound();
                 clickOnEggsScript.UpdateEggsString();
                 myEggPanelShadow = clickOnEggsScript.silEggsShadFades[posInPanel];
                 myEggPanelShadow.FadeIn();
                 trailFX.Stop(true);
                 if (lastSpawned)
                 {
                     // Sequence finished.
                     ClickOnEggs.inASequence = false;
                     lastSpawned             = false;
                 }
             }
         }
     }
 }
    // 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;
            }
        }
    }
Example #8
0
    void Update()
    {
        if (startEggMove)
        {
            spawnTimer += Time.deltaTime;
            if (spawnTimer > mySpawnDelay && !moveEgg)
            {
                myFadeScript.FadeIn();
                eggTypeAnim.SetTrigger("Scale");
                moveEgg = true;
                //endTrans = levelCompleteEggbagScript.eggBags[levelCompleteEggbagScript.levelsCompleted].gameObject.transform;
            }
            if (moveEgg)
            {
                if (!trailFX.isPlaying)
                {
                    trailFX.Play(true);
                }
                lerp += Time.deltaTime / duration;
                this.transform.position = Vector3.Lerp(startPos, endTrans.position, animCurve.Evaluate(lerp));
                if (lerp >= 1)
                {
                    eggBagAnim.SetTrigger("Scale");
                    levelCompEggCounterScript.eggAmnt++;
                    if (levelCompEggCounterScript.eggAmnt == 1)
                    {
                        levelCompleteEggbagScript.MakeNewBagFadeIn();
                    }
                    //AUDIO SOUND EGGS COUNTER
                    audioLevelCompleteScript.eggsCounterSnd();

                    myFadeScript.FadeOut();
                    arrivalFX.Play(true);
                    trailFX.Stop(true);
                    moveEgg      = false;
                    startEggMove = false;
                    // if (amIGolden) {
                    //  levelCompleteEggbagScript.MakeNewBagAppear();
                    // }
                }
            }
        }
    }
 void GoToMenu()
 {
     GlobalVariables.globVarScript.toHub = false;
     hubScript.inHub = false;
     if (!mainMenuScript.gameObject.activeSelf)
     {
         mainMenuScript.gameObject.SetActive(true);
         // Put in variables to make the main menu be faded out.
     }
     // - TO TURN OFF IMMEDIATELY - //
     foreach (GameObject levelButton in levelButtons)
     {
         levelButton.SetActive(false);
     }
     //backToMenuBtn.enabled = false;
     // - MAKE THE CLOUDS CLOSE - //
     foreach (MoveCloud cloud in cloudsToMove)
     {
         cloud.MoveIn();
     }
     // - FADE OUT BACKTOMENU BTN - //
     // backToMenuFadeScript.FadeOut();
     // backToMenuIconFadeScript.FadeOut();
     foreach (FadeInOutCanvasGroup hubCanvasGroupFadeScript in hubScript.hubCanvasGroupFadeScripts)
     {
         hubCanvasGroupFadeScript.FadeOut();
     }
     // Season Unlock
     foreach (SeasonLock seasonLockScript in seasonLockScripts)
     {
         seasonLockScript.BackToMenu();
     }
     // - FADE IN TITLE - //
     titleFade.FadeIn();
     // - FADE IN SOLID BACKGROUND - //
     solidBGFade.FadeIn();
     // - FADE IN ALL BUTTONS - //
     fadeBtnIn = true;
     mainMenuScript.ResetStory();
 }
Example #10
0
    void Start()
    {
        //eggPosIndex = clickOnEggsScript.eggSpots.IndexOf(mySpotInPanel);
        myEggIndex         = clickOnEggsScript.eggs.IndexOf(this.gameObject);
        myFoundSpotInPanel = GlobalVariables.globVarScript.eggsFoundOrder[myEggIndex];
        if (!eggAnim)
        {
            eggAnim = this.GetComponent <Animator>();
        }
        LoadEggFromCorrectScene();
        // If the egg has already been found previously (if it has been loaded as true)
        if (eggFound)
        {
            eggAnim.enabled = false;
            if (!mySpotInPanel)
            {
                mySpotInPanel = clickOnEggsScript.eggSpots[myFoundSpotInPanel];
            }
            this.transform.position    = new Vector3(mySpotInPanel.transform.position.x, mySpotInPanel.transform.position.y, mySpotInPanel.transform.position.z - 0.24f + (myFoundSpotInPanel * 0.01f) - 4);
            this.transform.eulerAngles = cornerRot;
            this.transform.localScale  = cornerEggScale;
            this.GetComponent <Collider2D>().enabled = false;
            if (!amIGolden)
            {
                clickOnEggsScript.eggsFound++;
                clickOnEggsScript.eggsInPanel++;
                if (clickOnEggsScript.eggsInPanel == puzzUnlockScript.puzzUnlockAmnt)
                {
                    puzzUnlockScript.ActivatePuzzle();
                }
            }
            else
            {
                goldenEgg.GetComponent <SpriteRenderer>().sortingLayerName = "Default";
                goldenEgg.transform.localPosition = Vector3.zero;
            }
            // else
            // {
            //  GameObject gEgg = GameObject.Find("GoldenEgg");
            //  gEgg.transform.localScale
            // }
            //moveThisEgg = true;
            //clickOnEggsScript.eggMoving -= 1;
            this.transform.parent = clickOnEggsScript.eggPanel.transform;
            //Debug.Log(this.gameObject.name + " has been loaded as found already.");
            clickOnEggsScript.UpdateEggsString();
            clickOnEggsScript.AddEggsFound();
            if (!amIGolden)
            {
                eggShadowFade = clickOnEggsScript.eggShadowsFades[myFoundSpotInPanel];
            }
            eggShadowFade.FadeIn();
        }
        else
        {
            //openPanelSpotx = mySpotInPanel.transform.position.x - (clickOnEggsScript.eggPanelHidden.transform.position.x - clickOnEggsScript.eggPanelShown.transform.position.x);
            //openPanelSpoty = mySpotInPanel.transform.position.y - (clickOnEggsScript.eggPanelHidden.transform.position.y - clickOnEggsScript.eggPanelShown.transform.position.y);
            //openPanelSpotz = mySpotInPanel.transform.position.z - (clickOnEggsScript.eggPanelHidden.transform.position.z - clickOnEggsScript.eggPanelShown.transform.position.z);
            //startSpotInPanel = new Vector3(openPanelSpotx, openPanelSpoty, openPanelSpotz);

            myStartPos = new Vector3(this.transform.position.x, this.transform.position.y, -4 + (clickOnEggsScript.eggsFound * -0.1f));
            myStartRot = new Vector3(this.transform.rotation.x, this.transform.rotation.y, this.transform.rotation.z);
            if (!amIGolden)
            {
                myStartScale = new Vector3(1.4f, 1.4f, 1);
            }                                                                          // Hardcoded, needs to be set to the end scale size of the egg in the "EggPop" animation which all the normal eggs use.
            else
            {
                myStartScale = new Vector3(this.transform.localScale.x, this.transform.localScale.y, this.transform.localScale.z);
            }

            // distToSpot = Vector3.Distance(new Vector3 (this.transform.position.x, this.transform.position.y, -4 + (clickOnEggsScript.eggsFound * -0.1f)), startSpotInPanel);
            // constantSpeed = (distToSpot + settleEggDist)/ timeToMove;

            // while (animCurveTestTime < 1)
            // {
            //  animCurveTestTime += Time.deltaTime;
            //  animCurveTestVal += animCurve.Evaluate(animCurveTestTime);
            //  animCurveTestFrames++;
            // }
            // if (animCurveTestTime > 1)
            // {
            //  animCurveTestAvVal = animCurveTestVal / animCurveTestFrames;
            // }
        }
    }
    void Update()
    {
        if (moveUp)
        {
            lerp += Time.deltaTime / moveDur;
            helperBird.transform.position = Vector3.Lerp(hiddenTrans.position, shownTrans.position, moveCurve.Evaluate(lerp));

            if (!audioBirdPop)
            {
                //AUDIO SWOOSH BIRD
                audioHelperBirdScript.youDidItSnd();
                audioBirdPop = true;
            }

            if (lerp >= 1f)
            {
                helperBird.transform.position = shownTrans.position;
                lerp         = 0f;
                moveUp       = false;
                waitForBubIn = true;
                textBubFadeScript.FadeIn();
                textBubPointerFadeScript.FadeIn();
                AdjustBubSize(bubSizeA);
            }
        }
        if (waitForBubIn && textBubFadeScript.shown)
        {
            congratsTextAnim.SetTrigger("PopIn");
            congratsTextFadeScript.FadeIn();
            waitForBubIn = false;

            //AUDIO BIRD HELP SOUND
            audioHelperBirdScript.birdHelpSound();
        }
        if (waitForConTxtOut)
        {
            if (congratsTextFadeScript.shown)
            {
                congratsTextFadeScript.FadeOut();
            }
            if (congratsTextFadeScript.hidden && counterCGFadeScript.hidden)
            {
                AdjustBubSize(bubSizeB);
            }
            if (congratsTextFadeScript.hidden && counterCGFadeScript.hidden && curBubSize == bubSizeB)
            {
                counterCGFadeScript.FadeIn();
                waitForConTxtOut = false;

                //AUDIO BIRD HELP SOUND
                audioHelperBirdScript.birdHelpSound();
            }
        }
        if (waitForCountOut)
        {
            if (counterCGFadeScript.shown)
            {
                counterCGFadeScript.FadeOut();
            }
            if (counterCGFadeScript.hidden && backBtnCGFadeScript.hidden)
            {
                AdjustBubSize(bubSizeC);
            }
            if (counterCGFadeScript.hidden && backBtnCGFadeScript.hidden && curBubSize == bubSizeC)
            {
                backBtnCGFadeScript.FadeIn();
                waitForConTxtOut = false;


                //AUDIO BIRD HELP SOUND
                audioHelperBirdScript.birdHelpSound();
            }
        }

        if (adjustingBubSize)
        {
            bubLerp               += Time.deltaTime / bubAdjustDur;
            curBubSize             = Mathf.Lerp(prevBubSize, newBubSize, bubLerp);
            textBubSpriteRend.size = new Vector2(curBubSize, textBubSpriteRend.size.y);
            if (bubLerp >= 1f)
            {
                bubLerp          = 0f;
                curBubSize       = newBubSize;
                adjustingBubSize = false;
            }
        }
    }
Example #12
0
    void Update()
    {
        if (startEggMove)
        {
            spawnTimer += Time.deltaTime;
            this.transform.Rotate(Vector3.forward * spinDir * (spinSpeed * Time.deltaTime));
            if (spawnTimer > mySpawnDelay && !showEgg)
            {
                // if (amIFirst) {
                //  rotateFXScript.RotatePlayFX();
                // }

                // AUDIO - EGG APPEARS!
                audioLevelCompleteScript.circleEggsSoloSnd();

                myFadeScript.FadeIn();
                myGlowFadeScript.FadeIn();
                spawnFX.Play();
                showEgg  = true;
                endTrans = levelCompleteEggbagScript.curEggbagFadeScript.gameObject.transform;
            }
            if (showEgg)
            {
                // Glow from current alpha value to 1f (maximum).
                if (spawnTimer >= glowMaxDelay && !glowMax)
                {
                    myGlowFadeScript.maxAlpha = 1f;
                    myGlowFadeScript.FadeIn(myGlowFadeScript.sprite.color.a);
                    // if (amIFirst) {
                    //  rotateFXScript.RotatePlayFX();
                    // }
                    glowMax = true;

                    // AUDIO - EGG APPEARS!
                    audioLevelCompleteScript.circleEggsSoloGoldSnd();
                }
                // Scene egg fades out.
                if (spawnTimer >= whiteDelay && !white)
                {
                    myFadeScript.FadeOut();
                    if (amIFirst)
                    {
                        rotateFXScript.RotatePlayFX();
                    }
                    white = true;

                    // AUDIO - WHITE EGGS APPEARS!
                    audioLevelCompleteScript.circleEggsGlowSnd();                     //nicer sound but doesnt help the gitching??
                    //audioLevelCompleteScript.circleEggsSoloSilverSnd();
                }
                // Plain egg fades in.
                if (spawnTimer >= plainDelay && !plain)
                {
                    myGlowFadeScript.FadeOut(0.25f);
                    plainEggFadeScript.FadeIn();
                    // if (amIFirst) {
                    //  rotateFXScript.RotatePlayFX();
                    // }
                    // myFadeScript.FadeOut();
                    plain = true;

                    // AUDIO - PLAIN EGGS APPEARS!
                    audioLevelCompleteScript.circleEggsSoloPlainSnd();
                }
                // Shake anim.
                if (spawnTimer >= shakeDelay && !shakeStarted)
                {
                    // eggAnim.SetTrigger("Shake");
                    // myFadeScript.FadeOut();
                    // Hardcoded because 1f is always the max.
                    // myGlowFadeScript.maxAlpha = 1f;
                    // myGlowFadeScript.FadeIn(myGlowFadeScript.sprite.color.a);
                    shakeStarted = true;
                    // moveEgg gets set to true at the end of the "Shake" animation.
                }
                // Move egg.
                if (spawnTimer >= moveDelay && !moveEgg)
                {
                    if (amIFirst)
                    {
                        rotateFXScript.RotatePlayFX(lvlCompEggSpawnScript.allEggToBagDuration);
                    }
                    moveEgg = true;

                    //AUDIO EGGS  IN BAG MOUVEMENT?
                    if (!audioMoveToBag)
                    {
                        audioLevelCompleteScript.eggsMoveInBagSnd();
                        audioMoveToBag = true;
                    }
                }
                if (moveEgg)
                {
                    if (!trailFX.isPlaying)
                    {
                        trailFX.Play(true);
                    }
                    lerp += Time.deltaTime / moveDuration;
                    this.transform.position = Vector3.Lerp(startPos, endTrans.position, animCurve.Evaluate(lerp));
                    // if (lerp >= 0.5f && !glowOut) {
                    //  myGlowFadeScript.FadeOut();
                    //  glowOut = true;
                    // }
                    if (lerp >= 1)
                    {
                        levelCompEggCounterScript.eggAmnt++;

                        // AUDIO - EGG REACHES BAG!
                        audioLevelCompleteScript.eggsCounterSnd();


                        //myFadeScript.FadeOut();
                        plainEggFadeScript.FadeOut();
                        myGlowFadeScript.FadeOut();
                        arrivalFX.Play(true);
                        trailFX.Stop(true);
                        showEgg      = false;
                        startEggMove = false;
                        spawnTimer   = 0f;
                        levelCompleteEggbagScript.bagAnim.SetTrigger("Scale");
                        //levelCompleteBagGlowScript.CalculateNewAlpha(myGlowValue);
                        if (amIFirst)
                        {
                            levelCompleteEggbagScript.StartCurrentBagGlow();
                            //levelCompleteEggbagScript.iniYPos = levelCompleteEggbagScript.curEggBagTrans.position.y;
                            //levelCompleteEggbagScript.bagRise = true;
                            //levelCompleteEggbagScript.bagAnim.SetTrigger("Rise");
                            FXSpeedScript.myPartSys.Play();
                        }
                        if (amIGolden)
                        {
                            bagExplosionWait = true;
                            FXSpeedScript.IncreaseSimulationSpeed();

                            // //AUDIO particules in bag
                            audioLevelCompleteScript.particulesInBagSnd();
                        }
                    }
                }
            }
        }

        if (bagExplosionWait)
        {
            bagExplodeDelay -= Time.deltaTime;
            if (bagExplodeDelay <= 0f)
            {
                levelCompleteEggbagScript.bagAnim.SetTrigger("Explode");
                bagExplosionWait = false;
            }
        }
    }
    void Update()
    {
        if (Tapped)
        {
            if (closed)
            {
                //clam sound
                audioBeachPuzzleScript.playOceanSound(clamSound);

                myCollider.enabled = false;
                open   = true;
                closed = false;
                myOpenClam.fadeDelay = false;
                myOpenClam.FadeIn();
                myClosedClam.fadeDelay = true;
                myClosedClam.FadeOut();

                foreach (BeachBubbles bubbles in myBubbles)
                {
                    bubbles.ResetBubble();
                    bubbles.activeClam = true;
                }
                Tapped = false;
            }
        }
        if (failed)
        {
            if (closed)
            {
                myCollider.enabled     = true;
                myClosedClam.fadeDelay = false;
                myClosedClam.FadeIn();
                myOpenClam.fadeDelay = true;
                myOpenClam.FadeOut();
                failed = false;
            }
            if (open /* && put delay for sound*/ || forceClose)
            {
                open       = false;
                closed     = true;
                forceClose = false;

                //failed match sound .. should put a delay or something
                //audioBeachPuzzleScript.failSFX();
            }
        }
        if (open && myMatch.matched)
        {
            timer += Time.deltaTime;
            if (timer >= timeDelay && open)
            {
                myOpenClam.FadeOut();
                matched = true;
                open    = false;

                //"matched" and "dissolve" sound
                audioBeachPuzzleScript.BubblesSFX();
                audioBeachPuzzleScript.addToMusicList(clamSound);
            }
        }

        if (setFadeDurToPlay)
        {
            showClamTimer += Time.deltaTime;
            if (showClamTimer >= clamUpDelay && clamWaiting)
            {
                clamAnim.SetTrigger("ShowClam");
                myClosedClam.FadeIn();
                clamWaiting = false;

                //sound clam pop
                audioBeachPuzzleScript.clamPopOutSFX();
            }
            if (showClamTimer >= (clamUpDelay + iniFadeInDur) && setFadeDurToPlay)
            {
                myClosedClam.fadeDuration = playFadeInDur;
                showClamTimer             = 0f;
                setFadeDurToPlay          = false;
            }
        }
    }
Example #14
0
 void FadeInPieces()
 {
     leftPieceFadeScript.FadeIn();
     rightPieceFadeScript.FadeIn();
 }