// show success panel after mini game is over and show the game results public void ShowSuccessPanel(bool gameOver, int gameID, int?highscore, int starsCount) { (string name, Sprite imageActive, Sprite imageInactive)gameData = gameProgress.GetIngredientInfo(gameID); GameObject stars; GameObject ingredientIcon; TextMeshProUGUI ingredientLabel; TextMeshProUGUI highscoreLabel; TextMeshProUGUI textAlex; // show different information and play different audio based on if player wants to quit the mini game or the mini game is over if (gameOver) { stars = successCanvas.transform.Find("Panel-Detail/Game-Success/Stars").gameObject; ingredientIcon = successCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/Ingredient-Icon").gameObject; ingredientLabel = successCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/Title-Game").gameObject.GetComponent <TextMeshProUGUI>(); highscoreLabel = successCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/HighScore-Game/HighScore-Text").gameObject.GetComponent <TextMeshProUGUI>(); textAlex = successCanvas.transform.Find("Panel-Detail/Alex/Speech-Bubble/Text (TMP)").gameObject.GetComponent <TextMeshProUGUI>(); switch (starsCount) { case 0: textAlex.text = "Schade!"; FindObjectOfType <AudioManager>().Play("fail"); break; case 1: textAlex.text = "Gut!"; FindObjectOfType <AudioManager>().Play("good"); break; case 2: textAlex.text = "Bravo!"; FindObjectOfType <AudioManager>().Play("bravo"); break; case 3: textAlex.text = "Perfekt!"; FindObjectOfType <AudioManager>().Play("perfect"); break; } successCanvas.SetActive(true); } else { stars = successQuitCanvas.transform.Find("Panel-Detail/Game-Success/Stars").gameObject; ingredientIcon = successQuitCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/Ingredient-Icon").gameObject; ingredientLabel = successQuitCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/Title-Game").gameObject.GetComponent <TextMeshProUGUI>(); highscoreLabel = successQuitCanvas.transform.Find("Panel-Detail/Game-Success/Label-Success-Detail/HighScore-Game/HighScore-Text").gameObject.GetComponent <TextMeshProUGUI>(); successQuitCanvas.SetActive(true); } if (starsCount > 0) { ingredientLabel.text = gameData.Item1 + " erhalten"; } else { ingredientLabel.text = gameData.Item1 + " nicht erhalten"; } highscoreLabel.text = highscore != null?highscore.ToString() : "-"; if (starsCount < 1) { ingredientIcon.transform.GetComponent <Image>().sprite = gameData.Item3; } else { ingredientIcon.transform.GetComponent <Image>().sprite = gameData.Item2; } menuBottom.SetActive(false); starStateController = uiController.GetComponent <StarStateController>(); starStateController.setStarGroup(stars, starsCount); }
void Awake() { gameProgress = new GameProgress(); starStateController = uiController.GetComponent <StarStateController>(); updateProgress(0, 0); }