(Unable to switch between states)
Here, is the code…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class printHere : MonoBehaviour
{
[SerializeField] Text StoryLine;
[SerializeField] State StartingState;
State state;
// Start is called before the first frame update
void Start()
{
state = StartingState;
StoryLine.text = state.GetStateStory();
}
// Update is called once per frame
void Update()
{
ManageStates();
}
private void ManageStates()
{
var nextStates = state.GetNextStates();
if(Input.GetKeyDown(KeyCode.Q))
{
state = nextStates[0];
}
else
if(Input.GetKeyDown(KeyCode.W))
{
state = nextStates[1];
}
else
if(Input.GetKeyDown(KeyCode.E))
{
state = nextStates[2];
}
}
}