I had a question regarding how to programmatically change the nextStates array. For instance, I have a scene where the player can look out their window to find a clue. However; I don’t want them to look out the window again and see the same thing. I made a public void method as outlined below, but I don’t know how to pass a new state as an argument.
public void SetNextState(int arrElement, State newState)
{
nextStates[arrElement] = newState;
}
I've tried to call it in this manner:
List<string> knowledge = new List<string>();
if(state.name == "BedroomWindow2")
{
knowledge.Add("Mr. Bojangles was left behind.");
}
if (state.name == "Bedroom")
{
foreach (string fact in knowledge)
{
if (fact.Contains("Mr. Bojangles was left behind."))
{
state.SetNextState(1, BedroomWindow3);
}
}
}