If someone could assist I was building my State Machine for my college class and for some reason I ran into an issue with creating my dictionary for each colored light in my scene. Here is what it looks like.
//State in which the bulb turns green
enum BulbGreen
{
ON,
OFF,
NUM_STATES
}
//State in which the bulb turns yellow
enum BulbYellow
{
ON,
OFF,
NUM_STATES
}
//State in which the bulb turns red
enum BulbRed
{
ON,
OFF,
NUM_STATES
}
//Keeping track of Current Bulb Color State
private BulbGreen curStateGreen = BulbGreen.ON;
private BulbYellow curStateYellow = BulbYellow.ON;
private BulbRed curStateRed = BulbRed.ON;
private Dictionary<curStateGreen, Action> gsm = new Dictionary<curStateGreen, Action> ();
private Dictionary<curStateYellow, Action> ysm = new Dictionary<curStateYellow, Action> ();
private Dictionary<curStateRed, Action> rsm = new Dictionary<curStateRed, Action>();
The private Dictionary curStateGreen, Yellow, and Red come up with an error stating.
Assets/LaPinska_Brandon_Lab1/TrafficLightStateMachine.cs(44,28): error CS0118: TrafficLightStateMachine.curStateRed' is a
field’ but a `type’ was expected
I also have to set up a timer on these lights to circulate from green to yellow to red back to green. If anyone can help I would greatly appreciate it.
If you cant help with this or know where to find out to allow me to learn why this is an issue I would also appreciate that as well.
Thank You fellow Unity3d’ers!