public void Start() { StaticCheckGame.reset(); if (StaticMinigame3Controller.getReplay() == true) { instructionsPanel.SetActive(false); } StaticCheckGame.reset(); if (StaticLanguage.getLanguage().Equals("portuguese")) { instructions.text = "Organiza o frigorífico o máximo número de vezes dentro do tempo limite, movendos as comidas para o respetivo lugar seguindo estas regras:\n - Bebidas na porta;\n - Apenas os vegetais e frutas podem estar na secção inferior do frigorífico;\n - Na mesma secção apenas pode existir uma família de alimentos."; instructionHighscoreSub.text = "Melhor Pontuação"; gameEndHighscoreSub.text = "Melhor Pontuação"; } else { instructions.text = "Organize the fridge, as many times as you can within the time limit, moving the foods to their respective places following these rules:\n - Drinks on the door;\n - Only vegetables and fruits can stay on the lower section of the fridge;\n - On the same section there can only be one food family."; instructionHighscoreSub.text = "Highscore"; gameEndHighscoreSub.text = "Highscore"; } if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer")) { sendToServer = new SendToServer(); } else { sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer"); } highscore.text = "" + sendToServer.minigame2Highscore; setFoods(); }
public void Start() { if (StaticLanguage.getLanguage().Equals("portuguese")) { legumesText.text = "Legumes e Verduras"; hidratosText.text = "Hidratos de Carbono"; proteinaVText.text = "Proteína Vegetal"; proteinaAText.text = "Proteína Animal"; frutaText.text = "Frutas"; } else { legumesText.text = "Vegetables"; hidratosText.text = "Carbohydrates"; proteinaVText.text = "Vegetable Protein"; proteinaAText.text = "Animal Protein"; frutaText.text = "Fruits"; } if (StaticMinigame3Controller.getReplay() == true) { instructionsPanel.SetActive(false); } StaticCheckGame.reset(); if (StaticLanguage.getLanguage().Equals("portuguese")) { instructions.text = "Organiza o teu prato, o máximo número de vezes dentro do tempo limite, movendo as comidas para o seu respetivo lugar."; instructionHighscoreSub.text = "Melhor Pontuação"; gameEndHighscoreSub.text = "Melhor Pontuação"; } else { instructions.text = "Organize your plate, as many times as you can within the time limit, moving the foods to their respective places."; instructionHighscoreSub.text = "Highscore"; gameEndHighscoreSub.text = "Highscore"; } if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer")) { sendToServer = new SendToServer(); } else { sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer"); } time.text = "" + roundTime; score.text = "" + scoreNumber; highscore.text = "" + sendToServer.minigame4Highscore; setIngredients(); }
IEnumerator nextRound() { yield return(new WaitForSeconds(0.5f)); for (int i = 0; i < foodButtons.Count; i++) { foodButtons [i].transform.SetParent(inventory.transform); } wrong.gameObject.SetActive(false); correct.gameObject.SetActive(false); gameOn = true; StaticCheckGame.nextRound(); StaticCheckGame.incRoundNumber(); setIngredients(); }
public void Update() { if (gameOn || StaticMinigame3Controller.getReplay() == true) { roundTime -= Time.deltaTime; if (roundTime > 0) { time.text = "" + (int)roundTime; score.text = "" + scoreNumber; } else { gameEnd(); } if (inventory.transform.childCount == 0) { setReplayFalse(); gameOn = true; StaticCheckGame.setGameEndedTrue(); if (StaticCheckGame.getSlotsChecked() == 5) { if (StaticCheckGame.getGameWin() == false) { wrong.gameObject.SetActive(true); correct.gameObject.SetActive(false); gameOn = false; StartCoroutine(nextRound()); } else { correct.gameObject.SetActive(true); wrong.gameObject.SetActive(false); scoreNumber++; gameOn = false; StartCoroutine(nextRound()); } } } } }
IEnumerator nextRound() { yield return(new WaitForSeconds(0.5f)); Image[] temp = new Image[6]; fullFoodButtons.CopyTo(temp); foodButtons = new List <Image> (); for (int i = 0; i < temp.Length; i++) { foodButtons.Add(temp [i]); } for (int i = 0; i < foodButtons.Count; i++) { foodButtons [i].transform.SetParent(inventory.transform); } wrong.gameObject.SetActive(false); correct.gameObject.SetActive(false); gameOn = true; StaticCheckGame.nextRound(); StaticCheckGame.incRoundNumber(); setFoods(); }
public void Update() { if (slotChecked == StaticCheckGame.getRoundNumber()) { if (StaticCheckGame.getGameEnded() == true) { if (transform.name.Contains("Fruit")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_0")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } else if (transform.name.Contains("Veg")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_1")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } else if (transform.name.Contains("Grains")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_2")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } else if (transform.name.Contains("ProteinA")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_3")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } else if (transform.name.Contains("ProteinV")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_4")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } slotChecked++; StaticCheckGame.incSlotsChecked(); } } }
public void Update() { string type = ""; if (slotChecked == StaticCheckGame.getRoundNumber()) { if (StaticCheckGame.getGameEnded() == true) { if (transform.name.Contains("Drinks")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("drink")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } if (transform.name.Contains("Bottom")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("vegetable") && !transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("fruit")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } if (transform.name.Contains("Panel")) { for (int i = 0; i < transform.childCount; i++) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("protein") && !transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("lact")) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } for (int i = 0; i < transform.childCount; i++) { if (i == 0) { if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("protein")) { type = "protein"; } else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("vegetable")) { type = "vegetable"; } else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("fruit")) { type = "fruit"; } else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("lact")) { type = "lact"; } } if (i > 0) { if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains(type)) { StaticCheckGame.setGameWinFalse(); slotChecked++; StaticCheckGame.incSlotsChecked(); return; } } } slotChecked++; StaticCheckGame.incSlotsChecked(); } } }