Ejemplo n.º 1
0
 private void GameOver()
 {
     timer.Stop();
     guessLink = null;
     txtBlGameOver.Visibility = Visibility.Visible;
     simonGame.EndOfGame();
 }
Ejemplo n.º 2
0
 public void EndOfGame()
 {
     if (_head != null)
     {
         _head           = null;
         currLink        = null;
         _linksCounter   = 0;
         _simonSaysColor = 0;
     }
 }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }
Ejemplo n.º 5
0
 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++;
     }
 }
Ejemplo n.º 6
0
 public SimonLink(int gameStatus, SimonLink next)
 {
     _data = gameStatus;
     _next = next;
 }
Ejemplo n.º 7
0
 public SimonList()
 {
     _head         = null;
     currLink      = null;
     _linksCounter = 0;
 }