public void Decrease(string Tag) { // Decrease BlueCubes counter. if (Tag == "BlueCube") { BlueCubes--; if (BlueCubes < 1) { // Launch Game Over. GameGovernor.GameOverScreen("Not enough ingredients."); } } // Decrease GreenSpheres counter. else if (Tag == "GreenSphere") { GreenSpheres--; if (GreenSpheres < 1) { // Launch Game Over. GameGovernor.GameOverScreen("Not enough ingredients."); } } // Decrease BrownCylinders counter. else if (Tag == "BrownCylinders") { BrownCylinders--; if (BrownCylinders < 1) { // Launch Game Over. GameGovernor.GameOverScreen("Not enough ingredients."); } } else if (Tag == "MegaBlueCube") { MegaBlueCubes--; if (MegaBlueCubes < 1) { // Launch Game Over. GameGovernor.GameOverScreen("Not enough ingredients."); } } else if (Tag == "MegaBrownCylinder") { MegaBrownCylinders--; if (MegaBrownCylinders < 1) { // Launch Game Over. GameGovernor.GameOverScreen("Not enough ingredients."); } } }
// Update is called once per frame void Update() { if (ValueClass.Playing) { if (ValueClass.TimerStart > 1) { ValueClass.TimerStart -= Time.deltaTime; int minutes = Mathf.FloorToInt(ValueClass.TimerStart / 60); if (minutes < 0) { minutes = minutes - 1; } string seconds = Mathf.RoundToInt(ValueClass.TimerStart % 60).ToString(); if (seconds.Length < 2) { seconds = "0" + seconds; } UITimer.text = "Time left: " + minutes + ":" + seconds; } else { //Trigger GameOver GameGovernor.GameOverScreen("Timeover!"); } } }