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 //
}