/// <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); }