I’m getting this error when trying to setup my timer (Assets/Scripts/ShroomScript.cs(47,25): error CS0029: Cannot implicitly convert type float' to
bool’)
using UnityEngine;
using System.Collections;
public class ShroomScript : MonoBehaviour {
private heroController player;
public float timeLeft = 60f;
// Use this for initialization
void Start () {
player = GameObject.FindGameObjectWithTag("Player").GetComponent<heroController>();
}
void OnTriggerEnter2D(Collider2D col) {
if(col.CompareTag("Player")){
AudioSource AS = col.GetComponent<AudioSource>();
AS.PlayOneShot(AS.clip);
Destroy(gameObject);
if (player.curHealth <=4)
{
player.HealthIncrease(1);
} else if (player.curHealth >= 5)
{
player.HealthIncrease(0);
}
player.shroomPower = true;
// timeLeft = 5;
}
}
void Update () {
if(timeLeft > 0)
{
Debug.Log("Waiting"+timeLeft);
timeLeft -= Time.deltaTime;
if (timeLeft = 0)
{player.shroomPower = false;}
}
}
}