Hi,
I’m trying to activate objects based on a countdown timer.
I’d like to activate one object if time is > 70sec, another if time < 30sec
and another if time is <= 0
Not sure why this won’t work beyond: if(timeLeft >= 70),
doesn’t seem to recognize the code after.
using UnityEngine;
using System.Collections;
public class CountdownTimerBonusTimer : MonoBehaviour {
public float timeLeft = 180.0f;
public GameObject GoldAward3;
public GameObject StarAward3;
public GameObject GoldAward2;
public GameObject StarAward2;
public GameObject GoldAward1;
public GameObject StarAward1;
public GameObject projectilePrefab;
private bool canInstantiateProjectile = true;
void Update()
{
timeLeft -= Time.deltaTime;
{
}
if(timeLeft >= 70)
{
if (canInstantiateProjectile)
{
GoldAward3.SetActive(true);
StarAward3.SetActive(true);
if(timeLeft < 30)
{
if (canInstantiateProjectile)
{
StarAward2.SetActive(true);
StarAward2.SetActive(true);
if(timeLeft == 0)
{
if (canInstantiateProjectile)
{
StarAward1.SetActive(true);
StarAward1.SetActive(true);
}
}}}}}}}