public void StartCurrentBagGlow() { levelsCompleted = GlobalVariables.globVarScript.levelsCompleted; curGlowScript = bagGlowsScripts[levelsCompleted]; curGlowScript.gameObject.SetActive(true); curGlowScript.FadeIn(); }
public void GetReferences() { myFadeScript = this.GetComponent <FadeInOutSprite>(); myGlowFadeScript = this.transform.Find("SmallEggGlow").GetComponent <FadeInOutSprite>(); eggAnim = this.transform.parent.GetComponent <Animator>(); SpriteMask sMask = this.GetComponent <SpriteMask>(); sMask.sprite = this.GetComponent <SpriteRenderer>().sprite; whiteOverlaySprite = this.transform.Find("WhiteOverlay").GetComponent <SpriteRenderer>(); plainEggFadeScript = this.transform.Find("PlainEgg").GetComponent <FadeInOutSprite>(); }
void GetCurrentReferences() { levelsCompleted = GlobalVariables.globVarScript.levelsCompleted; // Assign local cur bag references curEggbagFadeScript = eggBags[levelsCompleted]; nextEggbagFadeScript = eggBags[levelsCompleted + 1]; curEggBagTrans = curEggbagFadeScript.transform; // Assign local cur glow references curGlowFadeScript = bagGlowsScripts[levelsCompleted]; nextGlowFadeScript = bagGlowsScripts[levelsCompleted + 1]; }
// Use this for initialization void Start() { activeClam = false; gameObject.transform.localScale = gameObject.transform.localScale * (bubbleSize); StartPosition = gameObject.transform.localPosition; currentTime = 0; mySprite = this.gameObject.GetComponent <SpriteRenderer>(); myFade = this.gameObject.GetComponent <FadeInOutSprite>(); mySprite.enabled = false; activeSprite = false; fadeInOutSprite = false; myFade.FadeOut(); }
// curveTime += Time.deltaTime / fadeTime; // newAlpha = animCurve.Evaluate(curveTime); // fadeImage.color = new Color(fadeImage.color.r, fadeImage.color.g, fadeImage.color.b, newAlpha); void LateUpdate() { if (moveThisEgg == true) { timeTest += Time.deltaTime; //distLeft = Vector3.Distance(this.transform.position, startSpotInPanel); curveTime += Time.deltaTime / timeToMove; //distPercent = distLeft / distToSpot; moveSpeed = animCurve.Evaluate(curveTime); 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 - 0.24f + (clickOnEggsScript.eggsFound * 0.01f) /* - (clickOnEggsScript.eggPanelHidden.transform.position.z - clickOnEggsScript.eggPanelShown.transform.position.z) */; startSpotInPanel = new Vector3(openPanelSpotx, openPanelSpoty, myZInPanel); Vector3 adjustedScale = new Vector3(cornerEggScale.x * moveWithCamScript.newScale, cornerEggScale.y * moveWithCamScript.newScale, cornerEggScale.z * moveWithCamScript.newScale); this.transform.position = Vector3.Lerp(myStartPos, startSpotInPanel, moveSpeed); this.transform.eulerAngles = Vector3.Lerp(myStartRot, cornerRot, moveSpeed); this.transform.localScale = Vector3.Lerp(myStartScale, adjustedScale, moveSpeed); // Arrived at corner spot. if (Vector3.Distance(this.transform.position, startSpotInPanel) <= settleEggDist) { this.transform.position = startSpotInPanel; this.transform.eulerAngles = cornerRot; //this.transform.localScale = cornerEggScale; moveThisEgg = false; clickOnEggsScript.eggMoving -= 1; if (!amIGolden) { clickOnEggsScript.eggsInPanel++; puzzUnlockScript.PuzzleUnlockCheck(clickOnEggsScript.eggsInPanel); } else { clickOnEggsScript.AdjustGoldenEggCount(); goldenEgg.GetComponent <SpriteRenderer>().sortingLayerName = "Default"; } clickOnEggsScript.UpdateEggsString(); this.transform.parent = clickOnEggsScript.eggPanel.transform; this.transform.localScale = cornerEggScale; eggTrail.SetActive(false); myFoundSpotInPanel = GlobalVariables.globVarScript.eggsFoundOrder[myEggIndex]; if (!amIGolden) { eggShadowFade = clickOnEggsScript.eggShadowsFades[myFoundSpotInPanel]; } eggShadowFade.FadeIn(); //clickOnEggsScript.CheckIfLevelComplete(); } } }
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; } } } } }
public override void OnInspectorGUI() { DrawDefaultInspector(); if (!EditorApplication.isPlaying) { fadeInOutSpriteScript = target as FadeInOutSprite; //0 = startShow, 1 = startHidden if ((int)fadeInOutSpriteScript.myStartState == 0) { fadeInOutSpriteScript.shown = true; fadeInOutSpriteScript.hidden = false; EditorUtility.SetDirty(this); } else if ((int)fadeInOutSpriteScript.myStartState == 1) { fadeInOutSpriteScript.hidden = true; fadeInOutSpriteScript.shown = false; EditorUtility.SetDirty(this); } } }
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; // } } }