private void GameOverHat() { if (!playing) { BlackArea.Show(); hatController.ToggleControl(false); hatController.DestroyHat(); GanoOPerdio(); } }
/// <summary> /// Checks Wheter the level is completed. /// </summary> private void CheckLevelComplete() { if (gridLines == null) { return; } bool isLevelComplete = true; for (int i = 0; i < gridLines.Length; i++) { //只要有一个gridLines.completedLine = fase就是未完成 if (!gridLines [i].completedLine) { isLevelComplete = false; break; } } if (isLevelComplete) //过关 { timer.Stop(); //停止定时器 isRunning = false; try { ///Save the stars level DataManager.MissionData currentMissionData = DataManager.FindMissionDataById(Mission.wantedMission.ID, DataManager.filterdMissionsData); DataManager.LevelData currentLevelData = currentMissionData.FindLevelDataById(TableLevel.wantedLevel.ID); currentLevelData.starsLevel = StarsRating.GetLevelStarsRating(Timer.timeInSeconds, GameManager.movements, gridCells.Length); if (currentLevelData.ID + 1 <= currentMissionData.levelsData.Count) { ///Unlock the next level DataManager.LevelData nextLevelData = currentMissionData.FindLevelDataById(TableLevel.wantedLevel.ID + 1); nextLevelData.isLocked = false; } DataManager.SaveMissionsDataToFile(DataManager.filterdMissionsData); } catch (Exception ex) { Debug.Log(ex.Message); } ///Show the black area BlackArea.Show(); //深色背景 ///Show the awesome dialog GameObject.FindObjectOfType <AwesomeDialog> ().Show(); //显示过关的dialog Debug.Log("You completed level " + TableLevel.wantedLevel.ID); } }