public U9Transition CreateOnScoreTransition(List <Block> blocks, int layer, int tScore) { int layerMask = 1 << layer; layerMask = ~layerMask; Proj.ignoreLayers = layerMask; U9Transition onScoreTransition = null; transform.parent = blocks[blocks.Count / 2].transform; transform.localScale = Vector3.one; //onScoreTransition = U9T.T (iTween.MoveTo, this.gameObject, iTween.Hash("position", new Vector3(0, 0, -1000), "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); //onScoreTransition.Ended += (transition) => //{ float staggerTime = 0f; //0.45f; List <U9Transition> transitions = new List <U9Transition> (); foreach (Block m in blocks) { transitions.Add(m.CreateDisappearTransition(tScore)); } staggerTime = staggerTime / transitions.Count; U9Transition t = U9T.Stagger(staggerTime, transitions.ToArray()); t.Begin(); Destroy(this.gameObject); //}; return(new InstantTransition(onScoreTransition)); }
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; }
public override void Begin() { base.Begin(); if (childTransition != null) { childTransition.Begin(); } End(); }
/// <summary> /// Takes the player move and then waits until animations have completed before accepting any more input. /// </summary> /// <param name="edge">Edge.</param> void TakePlayerMove(GameController.Edge edge) { switch (GameController.Inst.ECurrentView) { case GameController.View.Intro: GameController.Inst.SwitchToView(GameController.View.Game); GameController.Inst.StartGame(); break; case GameController.View.Info: GameController.Inst.SwitchToView(GameController.View.Game); break; case GameController.View.Highscore: GameController.Inst.SwitchToView(GameController.View.Game); if (GameController.Inst.Platform != Platform.Web) { GameController.Inst.StartGame(); } break; case GameController.View.Newscore: GameController.Inst.SwitchToView(GameController.View.Game); if (GameController.Inst.Platform != Platform.Web) { GameController.Inst.StartGame(); } break; case GameController.View.Game: { if (GameController.Inst.GameCreated) { if (waitingForInput) { waitingForInput = false; U9Transition t = GameController.Inst.CreatePlayerMoveTransition(edge); t.Ended += (transition) => { waitingForInput = true; }; t.Begin(); } } break; } } }
void BeginNextTransition() { if (queue.Count > 0) { U9Transition t = queue.Peek(); t.Ended += HandleCurrentTransitionEnded; //Debug.Log ("BEGINNING QUEUED TRANS!"); t.Begin(); } else { if (QueueEmptied != null) { QueueEmptied(); } } }
void StartNextTransition() { if(completedTransitions < transitions.Count) { if(!current || current.IsCompleted) { current = transitions[completedTransitions]; current.Interrupted += OnTransitionInterrupted; current.Ended += OnTransitionEnded; current.IsCompleted = false; current.Begin(); } } else { End(); } }
void StartNextTransition() { if (completedTransitions < transitions.Count) { if (!current || current.IsCompleted) { current = transitions[completedTransitions]; current.Interrupted += OnTransitionInterrupted; current.Ended += OnTransitionEnded; current.IsCompleted = false; current.Begin(); } } else { End(); } }
/// <summary> /// Creates a transition which shifts blocks away from the given edge, checks for any matched blocks, and triggers game over if the board is full. /// </summary> /// <returns>The shift blocks transition.</returns> /// <param name="edge">Edge.</param> public U9Transition CreatePlayerMoveTransition(Edge edge) { if (_IntroLogo != null) { MoveIntro(edge); } for (int i = 1, ni = gridSize - 1; i < ni; i++) { for (int j = 1, nj = gridSize - 1; j < nj; j++) { Block b = blocks [i, j]; } } newScoreView.GetHideTransition().Begin(); highScoreView.GetHideTransition().Begin(); // If already gameover then ignore this request and return a null transition. if (gameIsOver) { RestartGame(false); } // If the intro is displaying then hide it. if (introView != null && introView.IsDisplaying) { introView.GetHideTransition().Begin(); } U9Transition t = U9T.P(CreateShiftBlocksTransition(edge)); // After the player move transition, if the game is over then start a new game, otherwise spawn blocks on the side that was just shifted t.Ended += (transition) => { U9Transition d = CreateMatchesTransition(); U9Transition gameOver = IsGameOver() ? CreateGameOverTransition() : null; if (gameOver != null) { gameOver.Ended += (transitionOver) => { if (gameIsOver) { if (Platform == Platform.Web) { Application.ExternalCall("SetHighScore", HighScore); Application.ExternalCall("GameOver"); } //!!! haxForSideBlocksNotSpawningInCorrectNumber = true; //!!! score = 0; scoresToAdd = 0; newScore = 0; _Timer = 0; StartGame(); currentScoreLabel.text = "0"; _ECurrentView = View.Game; } }; gameOver.Begin(); } else { if (d != null) { d.Begin(); } SpawnBlocks(edge); } }; return(t); }
/// <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))); }