IEnumerator SpawnRoutine() { while (!CurrentGameMode.IsGameOver()) { yield return(new WaitForSeconds(CurrentGameMode.GetDelay())); CurrentGameMode.Update(); } }
void Update() { if (CurrentGameMode != null) { if (CurrentGameMode.IsGameOver() && !isGameOver) { onFailPanel.SetActive(true); isGameOver = CurrentGameMode.IsGameOver(); Invoke("ReturnToMenu", 3f); } } }
internal IEnumerator ResolveBoardChange(float blockDestructionDelay) { yield return(StartCoroutine(CurrentGameMode.ClearBoard(blockDestructionDelay))); if (!processNextMove) { StartCoroutine(ResolveBoardChange(blockDestructionDelay)); processNextMove = true; yield break; } if (CurrentGameMode.IsGameOver()) { this.DestroyAll(currentPiece.gameObject); //gameOverText.Text = "Game Over\r\n"; if (FB.IsLoggedIn) { //Try to save high score var result = PersistentUtility.Instance.SaveHighScore(CurrentGameMode); } //Send playthrough information to server var scoreParse = new ParseObject("Score"); scoreParse["score"] = currentGameMode.Score; scoreParse["player"] = GlobalData.Instance.playerName; scoreParse["facebookUserID"] = GlobalData.Instance.playerFacebookID; scoreParse["gameVersion"] = GlobalData.Instance.version; scoreParse["gameMode"] = currentGameMode.ModeName; scoreParse["squaresCleared"] = currentGameMode.SquaresCleared; scoreParse["blocksCleared"] = currentGameMode.BlocksCleared; scoreParse["piecesPlaced"] = currentGameMode.PiecesPlaced; scoreParse["levelReached"] = currentGameMode.Level; scoreParse["maxChain"] = currentGameMode.MaxChain; scoreParse["maxCombo"] = currentGameMode.MaxCombo; scoreParse["totalChains"] = currentGameMode.TotalChains; scoreParse["totalCombos"] = currentGameMode.TotalCombos; scoreParse["timePlayed"] = currentGameMode.TimePlayed; scoreParse["hintsUsed"] = currentGameMode.HintsUsed; if (currentGameMode.ModeName == "PeriodicMode") { scoreParse["seedUsed"] = GlobalData.Instance.periodicModeSeed; scoreParse["rawSeedUsed"] = GlobalData.Instance.rawSeed; } scoreParse.SaveAsync(); GlobalData.Instance.GameStats = scoreParse; //gameOverText.PlayAnimation(); GameUIController.Instance.noMoreMovesMessage.GetComponents <dfTweenGroup>().Single(tg => tg.TweenName == "TweenCombined").Play(); GameUIController.Instance.gameOverMessage.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenIn").Play(); GameOver = true; waitUntilGameOverDismissal = 1.25f; } else { CurrentGameMode.UserHasPlayed = true; if (currentPiece.gameObject.activeSelf) { LayoutDTO nextPieceInfo = CurrentGameMode.GetNextPiece(); if (nextPieceInfo.Variant == Block.TOTAL_VARIANTS + 1) { GameUIController.Instance.NoMoreMovesTweenAlone.Play(); CurrentPiece.gameObject.SetActive(false); } if (nextPieceInfo != null) { CurrentPiece.InitPiece(nextPieceInfo.Layout, nextPieceInfo.Variant); } else { this.DestroyAll(CurrentPiece.gameObject); } } } }