private void GameOver() { timer.Stop(); guessLink = null; txtBlGameOver.Visibility = Visibility.Visible; simonGame.EndOfGame(); }
public void EndOfGame() { if (_head != null) { _head = null; currLink = null; _linksCounter = 0; _simonSaysColor = 0; } }
IEnumerator IEnumerable.GetEnumerator() { if (_head != null) { SimonLink tempLink = _head; int tempData; while (tempLink != null) { tempData = Convert.ToInt32(tempLink._data); yield return(tempData); Task.Delay(1200); tempLink = tempLink._next; } } }
private void GuessSimonSequence(int guess) { SimonLink tempLink = null; if (guessLink == null) { tempLink = simonGame._head; guessLink = tempLink; } else { tempLink = guessLink; } if (tempLink == null) { return; } if (simonGame._linksCounter >= guessCounter) { if (tempLink._data == guess) { guessLink = guessLink._next; guessCounter++; } else { GameOver(); return; } if (simonGame._linksCounter == guessCounter) { simonGame.AddGameStep(); guessCounter = 0; guessLink = null; simonGame.currLink = simonGame._head; isReveal = true; } } }
public void AddGameStep() { if (_head != null) { SimonLink tempLink = _head; while (tempLink._next != null) { tempLink = tempLink._next; } int nextGameStep = SimonSays(); SimonLink newLink = new SimonLink(nextGameStep, null); tempLink._next = newLink; _linksCounter++; } else { int status = SimonSays(); SimonLink firstLink = new SimonLink(gameStatus: status, next: null); _head = firstLink; currLink = _head; _linksCounter++; } }
public SimonLink(int gameStatus, SimonLink next) { _data = gameStatus; _next = next; }
public SimonList() { _head = null; currLink = null; _linksCounter = 0; }