void GameStart() { Minigame.SetActive(false); Bumbu1.SetActive(false); Bumbu2.SetActive(false); telurGoreng.SetActive(false); NasiP.SetActive(false); NasiG.SetActive(false); Panel1 = false; Panel2 = false; Panel3 = false; Panel4 = false; score = 0; Achieve.value = score; startPos = AIoned.transform.position; Debug.Log(startPos); AI1 = true; AI2 = false; AI3 = false; AI4 = false; Time.timeScale = 1; if (Level == 1) { Achieve.maxValue = 45; timerF = 60; Hitung = true; } if (Level == 2) { Achieve.maxValue = 60; timerF = 100; Hitung = true; } if (Level == 3) { Achieve.maxValue = 100; timerF = 140; Hitung = true; } Winlose.SetActive(false); B0.SetActive(false); B1.SetActive(false); B2.SetActive(false); B3.SetActive(false); PauseBG.SetActive(true); Pauz.SetActive(false); }
void Update() { Achieve.value = score; if (Level == 1 && play == true) { if (Hitung == true) { timerF -= Time.deltaTime; } timer.text = "" + timerF.ToString("f0"); if (score >= 45) { if (timerF >= 20) { play = false; Winlose.SetActive(true); B3.SetActive(true); Hitung = false; Debug.Log("You win"); ClearAI(); ClearAll(); Time.timeScale = 0; bintang = 3; } else if (timerF < 20) { play = false; Winlose.SetActive(true); B2.SetActive(true); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang = 2; } } else if (timerF <= 0) { if (score > 15) { play = false; Winlose.SetActive(true); B1.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang = 1; } else { play = false; Winlose.SetActive(true); B0.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang = 0; } } } if (Level == 2 && play == true) { if (Hitung == true) { timerF -= Time.deltaTime; } timer.text = "" + timerF.ToString("f0"); if (score >= 60) { if (timerF >= 30) { play = false; Winlose.SetActive(true); B3.SetActive(true); Hitung = false; Debug.Log("You win"); ClearAI(); ClearAll(); Time.timeScale = 0; bintang2 = 3; } else if (timerF < 30) { play = false; Winlose.SetActive(true); B2.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang2 = 2; } } else if (timerF <= 0) { if (score > 20) { play = false; Winlose.SetActive(true); B1.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang2 = 1; } else { play = false; Winlose.SetActive(true); B0.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang2 = 0; } } } if (Level == 3 && play == true) { if (Hitung == true) { timerF -= Time.deltaTime; } timer.text = "" + timerF.ToString("f0"); if (score >= 100) { if (timerF >= 40) { play = false; Winlose.SetActive(true); B3.SetActive(true); Hitung = false; Debug.Log("You win"); ClearAI(); ClearAll(); Time.timeScale = 0; bintang3 = 3; } else if (timerF < 40) { play = false; Winlose.SetActive(true); B2.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang3 = 2; } } else if (timerF <= 0) { if (score > 40) { play = false; Winlose.SetActive(true); B1.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang3 = 1; } else { play = false; Winlose.SetActive(true); B0.SetActive(true); ClearAI(); Hitung = false; ClearAll(); Debug.Log("You win"); Time.timeScale = 0; bintang3 = 0; } } } AIoned.SetActive(AI1); AItwod.SetActive(AI2); AIthreed.SetActive(AI3); AIfoured.SetActive(AI4); Waving(); }