hello… im trying to create a timebomb game…
Bomb script attach on Bomb prefab , whenever player drop a bomb its explode after 3 sec… at this point all are ok. I don’t know how to use if statement when ever time button is active bomb stop explode if button pressed bomb blast immediately.
plz check the bomb script.
void Start()
{
Invoke("Explode", 3f);
Start Coroutine(Collider());
}
im using button on player script to control explosion but its explosion in 3 sec
public void TimeBomb()
{
TimeBombButton.gameObject.SetActive(true);
bomb.enabled = false;
Debug.Log(" Bomb False");
}
public void ButtonPress()
{
Bomb.enabled = true;
Debug.Log(" Bomb Enable");
StartCoroutine(Timer());
GameObject.Find("Bomb(Clone)").GetComponent<Bomb>().enabled = true;
// 3
bomb.explosion();
//bomb.GetComponent<MeshRenderer>().enabled = true;
}
private IEnumerator Timer()
{
yield return new WaitForSeconds(0.1f);
bomb.GetComponent<MeshRenderer>().enabled = true;
Bomb.enabled = false;
}