void Update() { if (Input.GetKey("escape")) { Application.Quit(); } if (scheduleNextState && (FutureGenerations.Count < maxQueuedCount)) { Future <Dictionary <Vector2, int> > futureState = new Future <Dictionary <Vector2, int> >(); futureState = Rules.ComputeNextState(lastProcessedStates, CellCount); futureState.OnSuccess((states) => { FutureGenerations.Enqueue(states.value); lastProcessedStates = states.value; scheduleNextState = true; }); scheduleNextState = false; } }