public static LT ( U9LeanTweenTransition, hoToTween, GameObject target, Vector3 to, float duration, Hashtable args ) : U9LeanTweenTransition, | ||
hoToTween | U9LeanTweenTransition, | |
target | GameObject | |
to | Vector3 | |
duration | float | |
args | Hashtable | |
return | U9LeanTweenTransition, |
private void MoveIntro(Edge edge) { Vector3 MoveTo = new Vector3(0, 0, 0); switch (edge) { case Edge.Bottom: MoveTo = new Vector3(0, 800, 0); break; case Edge.Left: MoveTo = new Vector3(800, _IntroLogo.transform.position.y, 0); break; case Edge.Right: MoveTo = new Vector3(-800, _IntroLogo.transform.position.y, 0); break; case Edge.Top: MoveTo = new Vector3(0, -800, 0); break; } //U9Transition transitions = U9T.HOT(HOTween.To, _IntroLogo.transform, 0.2f, new TweenParms().Prop("localPosition", MoveTo, false).Ease(EaseType.EaseOutQuad)); U9Transition transitions = U9T.LT(LeanTween.moveLocal, _IntroLogo, MoveTo, 0.2f, iTween.Hash("ease", LeanTweenType.easeOutQuad)); transitions.Ended += (transition) => { Destroy(_IntroLogo); }; U9T.S(U9T.W(0.2f), transitions).Begin(); }
public IEnumerator StartGameIE() { colorPalette = colorManager.getBlockColors(); foreach (Transform t in transform) { GameObject.Destroy(t.gameObject); } BackgroundBlocks = new List <Blocks>(); // Initialise space for the blocks in the grid blocks = new Block[gridSize, gridSize]; // Calculate the bottom left position of the grid gridBaseline = -0.5f * new Vector3(((blockPaddingSize + blockSize) * (gridSize - 1)), (blockPaddingSize + blockSize) * (gridSize - 1), 0f); gridBaseline.y += 60.0f; // Initialise Game Services GooglePlayGames.PlayGamesPlatform.Activate(); // Spawn the static background blocks for (int j = gridSize - 2, nj = 0; j > nj; j--) { for (int i = 1, ni = gridSize - 1; i < ni; i++) { Block backgroundBlockInstance = (Block)Instantiate(blockPrefab); backgroundBlockInstance.SquareSize = blockSize; backgroundBlockInstance.Color = HexColor.ColorFromHex("D2D2D2" /*"E9ECEE"*/); backgroundBlockInstance.transform.parent = transform; backgroundBlockInstance.transform.localPosition = GridPosTo3DPos(i, j, -10); backgroundBlockInstance.transform.localScale = Vector3.one; // * 0.001f; backgroundBlockInstance.IsBackground = true; backgroundBlockInstance.gameObject.layer = 8; Blocks sBlock = new Blocks(); sBlock.block = backgroundBlockInstance; BackgroundBlocks.Add(sBlock); //U9Transition transitions = U9T.HOT (HOTween.To, backgroundBlockInstance.gameObject.transform, 0.3f, new TweenParms().Prop("localScale", Vector3.one,false).Ease(EaseType.EaseOutExpo)); U9Transition transitions = U9T.LT(LeanTween.scale, backgroundBlockInstance.gameObject, Vector3.one, 0.3f, iTween.Hash("ease", LeanTweenType.easeOutExpo)); //U9Transition transitions = U9T.T (iTween.ScaleTo, backgroundBlockInstance.gameObject, iTween.Hash ("scale", new Vector3(1,1,1), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo )); transitions.Begin(); yield return(new WaitForSeconds(0.05f)); } } GameObject intro = (GameObject)Instantiate(_IntroEffect); StartNewGame(); GameCreated = true; }
/// <summary> /// Returns a transition that moves the block in the source position to the destination position /// </summary> /// <returns>The move block transition.</returns> /// <param name="sourceI">Source i.</param> /// <param name="sourceJ">Source j.</param> /// <param name="destI">Destination i.</param> /// <param name="destJ">Destination j.</param> U9Transition CreateMoveBlockTransition(int sourceI, int sourceJ, int destI, int destJ) { Block b = blocks [sourceI, sourceJ]; // If the source block does not exist then return a null transition. if (!b) { return(U9T.Null()); } //!! // If source and dest positions are the same then return a null transition if (sourceI == destI && sourceJ == destJ) { //return U9T.T (iTween.ShakePosition, b.gameObject, iTween.Hash ("x", 0.05f, "y", 0.05f, "time", 0.3f, "islocal", false)); return(U9T.Null()); } //!! // If the destination position is already occupied then return a null transition if (blocks [destI, destJ]) { Debug.LogError("Destination is already occupied by a block!"); return(U9T.Null()); } // Move the block in data blocks [sourceI, sourceJ] = null; blocks [destI, destJ] = b; // Update the blocks position b.I = destI; b.J = destJ; // Disable the fading on the block b.Ghost = false; // Return a tween to move the blocks gameObject //return U9T.HOT(HOTween.To, b.gameObject.transform, 0.3f, new TweenParms().Prop("localPosition", GridPosTo3DPos (destI, destJ, 0), false).Ease(EaseType.EaseOutCirc)); //return U9T.T (iTween.MoveTo, b.gameObject, iTween.Hash ("position", GridPosTo3DPos (destI, destJ, 0), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutCirc )); return(U9T.LT(LeanTween.moveLocal, b.gameObject, GridPosTo3DPos(destI, destJ, 0), 0.3f, iTween.Hash("ease", LeanTweenType.easeOutCirc))); }
/// <summary> /// Instantiates a block and returns a transition to move it into place /// </summary> /// <returns>The spawn transition.</returns> /// <param name="i">The index.</param> /// <param name="j">J.</param> U9Transition SpawnBlock(int i, int j) { Block b = (Block)Instantiate(blockPrefab); b.transform.parent = transform; b.transform.localPosition = GridPosTo3DPos(i, j, blockSize); b.transform.localScale = Vector3.one; b.Color = colorPalette [Random.Range(0, GetColourPalletteSize())]; Color temporaryColorHolder = b.Color; temporaryColorHolder.a *= 0.5f; b.Ghost = true; b.SquareSize = blockSize; b.I = i; b.J = j; blocks [i, j] = b; //return U9T.HOT(HOTween.To, b.gameObject.transform, 0.2f, new TweenParms().Prop("localPosition", GridPosTo3DPos (i, j, 0), false).Ease(EaseType.EaseOutQuad)); //return U9T.T (iTween.MoveTo, b.gameObject, iTween.Hash ("position", GridPosTo3DPos (i, j, 0), "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad )); return(U9T.LT(LeanTween.moveLocal, b.gameObject, GridPosTo3DPos(i, j, 0), 0.2f, iTween.Hash("ease", LeanTweenType.easeOutCirc))); }
/// <summary> /// Creates a transition which disappears the block and spawns a score label in its place, which will itself disappear after some time. /// </summary> /// <returns>The disappear transition.</returns> /// <param name="score">Score.</param> public U9Transition CreateDisappearTransition(int score) { U9Transition scorePopupTransition = null; //U9Transition blockDisappearTransition = U9T.HOT (iTween.ScaleTo, squareSprite.gameObject, iTween.Hash ("scale", Vector3.zero, "time", 0.25f, "easetype", iTween.EaseType.easeInOutQuad )); //U9Transition bDT = U9T.HOT (HOTween.To, Scaling, 0.25f, new TweenParms().Prop("localScale", Vector3.zero, false).Ease(EaseType.EaseInOutQuad)); U9Transition bDLT = U9T.LT(LeanTween.scale, squareGO, Vector3.zero, 0.25f, iTween.Hash("ease", LeanTweenType.easeInOutQuad)); if (score > 0) { /*GameObject popupScoreInstance = (GameObject)Instantiate(scorePrefab[score-3], transform.position, Quaternion.identity); * popupScoreInstance.transform.parent = transform; * popupScoreInstance.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); * * int materialIn = 5*(score-3); * for(int i = materialIn; i < 5 + materialIn; i++) * { * if(scoreMaterial[i].color == color) * { * Color newColor = new Color(scoreMaterial[i].color.r, scoreMaterial[i].color.g, scoreMaterial[i].color.b, 0); * popupScoreInstance.renderer.material.color = newColor; * break; * } * } * * U9Transition ScaleIn = U9T.LT (LeanTween.scale, popupScoreInstance, new Vector3(53f, 53f, 53f), 1f, iTween.Hash("ease", LeanTweenType.linear)); * U9Transition FadeIn = U9T.HOT (HOTween.To, popupScoreInstance.renderer.material, 0.35f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 1), false).Ease(EaseType.EaseInOutQuad)); * U9Transition FadeOut = U9T.HOT (HOTween.To, popupScoreInstance.renderer.material, 0.55f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 0), false).Ease(EaseType.EaseInOutQuad).Delay(0.65f)); * * ScaleIn.Begin(); * FadeIn.Begin(); * FadeOut.Begin();*/ PopupScoreLabel popupScoreLabelInstance = (PopupScoreLabel)Instantiate(popupScoreLabelPrefab, transform.position, Quaternion.identity); popupScoreLabelInstance.transform.parent = transform; popupScoreLabelInstance.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); popupScoreLabelInstance.Score = score; Color c = new Color(color.r, color.g, color.b, 0); popupScoreLabelInstance.Color = c; U9Transition ScaleIn = U9T.LT(LeanTween.scale, popupScoreLabelInstance.gameObject, new Vector3(0.6f, 0.6f, 0.6f), 1f, iTween.Hash("ease", LeanTweenType.linear)); U9Transition FadeIn = U9T.HOT(HOTween.To, popupScoreLabelInstance.GetComponent <UILabel>(), 0.35f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 1), false).Ease(EaseType.EaseInOutQuad)); U9Transition FadeOut = U9T.HOT(HOTween.To, popupScoreLabelInstance.GetComponent <UILabel>(), 0.55f, new TweenParms().Prop("color", new Color(color.r, color.g, color.b, 0), false).Ease(EaseType.EaseInOutQuad).Delay(0.65f)); ScaleIn.Begin(); FadeIn.Begin(); FadeOut.Begin(); //U9Transition FadeIn = U9T.LT (LeanTween.alpha, popupScoreLabelInstance, 1.0f, 0.35f, iTween.Hash("ease", LeanTweenType.easeInCubic)); Destroy(popupScoreLabelInstance, 5.0f); } bDLT.Ended += (transition) => { Destroy(gameObject, 4.0f); }; return(new InstantTransition(U9T.S(bDLT))); }