// Update is called once per frame void Update() { switch (state) { case State.Update: var info = conv.GetInfo(); convDisplay.Show(info); state = State.Waiting; break; case State.Waiting: int next = WaitForConfirm(); if (next != -1) { Debug.Log(next); if (!conv.Next(next)) { throw new Exception("Could not go forward, next is " + next.ToString()); } state = conv.Complete ? State.Done : State.Update; // will be activated on the next update convDisplay.Deactivate(); } break; case State.Done: if (postExecution != null) { postExecution(); } gameObject.SetActive(false); break; } }