if (nextActionTime == timeToEngineProblem && !generateProblem) // I need to check this, but it doesn't work the "timer" is still counting but doesn't check
This is what I do: ...
[SerializeField] float nextActionTime = 0f;
[SerializeField] private float periodTime = 0.1f;
[SerializeField] float timeToEngineProblem = 10f;
[SerializeField] bool generateProblem;
void Update ()
{
if (Time.time > nextActionTime)
{ nextActionTime += periodTime;
Debug.Log("Time: " + nextActionTime);
if (nextActionTime == timeToEngineProblem && !generateProblem) // There is what i need to check
{
Debug.Log("The problems begin");
generateProblem = true;
TruckEngineProblem();
}
}
}