public void Start() { // Add all posible states game = gameObject.AddComponent <GameState>(); paused = gameObject.AddComponent <PausedState>(); // Default state state = paused.State(); StartCoroutine(Run()); }
public IEnumerable State() { countdown = 3; while (countdown > 0) { Debug.Log("Playing for " + countdown + "..."); countdown--; yield return(new WaitForSecondsRealtime(1)); } fsm.state = paused.State(); }