Question by
WaiYsky · Feb 05, 2017 at 01:39 PM ·
delayhealth-deductionhealth
how to put in a delay in void
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using UnityEngine.UI;
public class ScoreBicycles : MonoBehaviour { public GameObject[] smallbicycles; private int health;
public MenuSceneUi ui;
void Start()
{
//ui = GetComponent<MenuSceneUi>();
health = smallbicycles.Length;
print(health);
}
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "MYBICYCLE")
{
print("it's deducting score well enough");
health = health - 1;
smallbicycles[health].SetActive(false);
if (health == 0)
{
ui.gameOverActivated();
health = 0;
}
}
}
}
where i want to delay is
if (health == 0) { // here to // ui.gameOverActivated(); // // health = 0; // //here // }
Comment
Answer by WaiYsky · Feb 05, 2017 at 01:42 PM
I want to delay of 5 second before the game is over. Please help me I only have a day to submit my project.