void OnTouchGoal(GameObject goal) { if (freeze) { return; } // Level completed so just freeze the player. freeze = true; float level_completion_time = Time.time - levelStartTime; int total_collectables = Collectable.AllCollectables.Length; int collected_collectables = 0; foreach (GameObject obj in Collectable.AllCollectables) { if (obj && !obj.activeSelf) { collected_collectables++; } } // Would be used for high scores. /*Level currentlevel = LevelController.currentLevel; * if (currentlevel != null) * { * currentlevel.BestCollectables = Mathf.Max(collected_collectables, currentlevel.BestCollectables); * currentlevel.BestTime = Mathf.Min(level_completion_time, currentlevel.BestTime); * currentlevel.BestComboLost = Mathf.Min(droppedCombo, currentlevel.BestComboLost); * }*/ if (gameHUD != null) { gameHUD.LevelFinished(level_completion_time, collected_collectables, total_collectables, droppedCombo); } }