/// <summary> /// Creates the game over transition /// </summary> /// <returns>The game over transition.</returns> U9Transition CreateGameOverTransition() { int previousBestScore = HighScore; U9Transition gameOverViewTransition = null; SubmitScore(); if (Score > HighScore) { HighScore = score; highScoreView.Setup(HighScore); ECurrentView = View.Highscore; } else { newScoreView.Setup(score); ECurrentView = View.Newscore; } // Set the game over flag gameIsOver = true; score = 0; currentScoreLabel.text = "0"; // Return a transition which clears the board and displays the appropriate game over view return(U9T.S(/*CreateClearBoardTransition()*/)); }
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 U9Transition GetPushViewTransition(U9View newView, bool hideOldView = true, bool force = false, bool hideAfter = false) { U9View oldView = null; if (viewStack.Count > 0) { oldView = viewStack.Peek(); } viewStack.Push(newView); U9Transition hideOldViewTransition = null, displayNewViewTransition = null; if (oldView) { oldView.DisableInteraction(); if (hideOldView) { hideOldViewTransition = oldView.GetHideTransition(force); } } displayNewViewTransition = newView.GetDisplayTransition(force); if (hideAfter) { return(U9T.S(displayNewViewTransition, hideOldViewTransition)); } else { return(U9T.S(hideOldViewTransition, displayNewViewTransition)); } }
/// <summary> /// Restarts the game. /// </summary> /// <param name="displayIntro">If set to <c>true</c> display intro.</param> void RestartGame(bool displayIntro) { gameIsOver = false; U9Transition t; t = U9T.S(U9T.P(displayIntro ? introView.GetDisplayTransition() : null)); t.Begin(); }
/// <summary> /// Plays transitions in parallel, with a specified interval between each one. /// </summary> /// <param name='staggerOffset'> /// Start time offset. /// </param> /// <param name='ignoreTimescale'> /// Set to true to ignore timescale settings. /// </param> /// <param name='transitions'> /// Transitions to stagger. /// </param> public static U9ParallelTransition Stagger(float staggerOffset, bool ignoreTimescale, params U9Transition[] transitions) { U9ParallelTransition stagger = new U9ParallelTransition(); float currentOffset = 0f; foreach (U9Transition t in transitions) { if (t && !t.IsNull) { stagger.AddTransition(U9T.S(U9T.W(currentOffset, ignoreTimescale), t)); currentOffset += staggerOffset; } } return(stagger); }
U9Transition CreateCompositeTransition(U9Transition[] ts) { switch (compositionType) { case CompositionType.Parallel: return(U9T.P(ts)); case CompositionType.Serial: return(U9T.S(ts)); case CompositionType.Stagger: return(U9T.Stagger(0.1f, ts)); default: return(null); } }
public U9Transition GetPopViewTransition(int popCount = 1, bool force = false, bool displayFirst = false) { //PrintStack(); List <U9Transition> popTransitions = new List <U9Transition>(); while (viewStack.Count > 0 && popCount > 0) { popTransitions.Add(viewStack.Pop().GetHideTransition(force)); popCount--; } U9View newView = null; if (viewStack.Count > 0) { newView = viewStack.Peek(); } U9Transition displayNewView = null; if (newView) { if (!newView.IsDisplaying) { displayNewView = newView.GetDisplayTransition(force); } else { newView.EnableInteraction(); } } //PrintStack(); if (displayFirst) { return(U9T.S(displayNewView, U9T.S(popTransitions.ToArray()))); } else { return(U9T.S(U9T.S(popTransitions.ToArray()), displayNewView)); } }
/// <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))); }