private IEnumerator ResetRoutine() { int stackCount = undoStack.Count; for (int i = 0; i < stackCount; i++) { UndoElement undo = undoStack.Pop(); yield return(RotateCubeRoutine = StartCoroutine(undo.undoCommand(undo.angle, .1f, false))); } RotateCubeRoutine = null; checkForWin = false; }
public void AddToUndoStack(UndoElement undoElement) { undoStack.Push(undoElement); if (checkForWin) { if (Face.IsWinState) { Debug.Log("Win!"); celebrationParticles.Play(); checkForWin = false; } } }
private IEnumerator ExecuteUndo() { if (Blocked) { yield break; } while ((undoStack.Count > 0) && (UndoClickCount > 0)) { UndoElement undo = undoStack.Pop(); UndoClickCount--; yield return(StartCoroutine(undo.undoCommand(undo.angle, turnDuration, false))); } if (undoStack.Count == 0) { checkForWin = false; } undoRoutine = null; }