I am having a issue creating a timer that changes the color of my traffic light. This is the code that I currently have. I have two different scripts. One for a State Machine and one for the Lights.
private bool isGreen = true;
private bool isYellow = true;
private bool isRed = true;
private float timePassed = Time.deltaTime ++;
bool IsLightGreen()
{
return isGreen;
}
bool IsLightYellow()
{
return isYellow;
}
bool IsLightRed()
{
return isRed;
}
void ToggleLight()
{
isGreen = !isGreen;
isYellow = !isYellow;
isRed = !isRed;
}
}
I am probably going all about this wrong but I keep researching time and color changing and all I can find is posts about using java script which I have a hard time reading and translating it to C#. Any suggestions would be great. Keep in mind I am super beginner and am in college still learning C#.
Thanks