Ejemplo n.º 1
0
 private void ChangeColorOnHit(Player player)
 {
     if (random.Next(2) == 1)
         player.ChangeToNextColor();
     else
         player.ChangeToPreviousColor();
 }
Ejemplo n.º 2
0
 public void HitPlayer(Player player)
 {
     if (Parent.Difficulty >= 3)
         KillOnHit(player);
     else
         ChangeColorOnHit(player);
 }
Ejemplo n.º 3
0
        public Interface()
        {
            _currentPlayer = Player.UpperPlayer;
            _currentZone = GameZone.CardsOnTable;
            _currentIndex = 0;

            _upperPlayerCardsOnBoard = new List<string> {"card 1", "card 2", "card 3"};
            _upperPlayerCardsInHand = new List<string> {"card 1", "card 2", "card 3"};
            _lowerPlayerCardsInHand = new List<string> {"card 4", "card 5", "card 6"};
            _lowerPlayerCardsOnBoard = new List<string> {"card 1", "card 2", "card 3"};

            Print(_currentPlayer, _currentZone, _currentIndex);
        }
Ejemplo n.º 4
0
        public Interface()
        {
            _currentPlayer = Player.UpperPlayer;
            _currentZone = GameZone.CardsOnTable;
            _currentIndex = 0;

            var Engine = new GameLogic.Engine();
            Engine.StartGame();

            _upperPlayerCardsOnBoard = new List<string> {"card 1", "card 2", "card 3"};
            _upperPlayerCardsInHand = new List<string>();
            foreach (var setOfCard in Engine.UpperPlayer.Cards)
            {
                _upperPlayerCardsInHand.Add(setOfCard.ToString());
            }
            _lowerPlayerCardsInHand = new List<string>();
            foreach (var setOfCard in Engine.LowerPlayer.Cards)
            {
                _lowerPlayerCardsInHand.Add(setOfCard.ToString());
            }
            _lowerPlayerCardsOnBoard = new List<string> { "card 1", "card 2", "card 3" };

            Print(_currentPlayer, _currentZone, _currentIndex);
        }
Ejemplo n.º 5
0
 public void KeyHandler()
 {
     while (true)
     {
         ConsoleKeyInfo pressedKey = Console.ReadKey();
         if (pressedKey.Key == ConsoleKey.UpArrow)
         {
             if (_currentPlayer == Player.UpperPlayer && _currentZone == GameZone.CardsOnTable)
             {
                 if (_currentIndex == 0)
                 {
                     _currentZone = GameZone.CardsInHands;
                     _currentIndex = _upperPlayerCardsInHand.Count - 1;
                 }
                 else
                 {
                     _currentIndex--;
                 }
             }
             else if (_currentPlayer == Player.UpperPlayer && _currentZone == GameZone.CardsInHands)
             {
                 if (_currentIndex == 0)
                 {
                     _currentZone = GameZone.CardsOnTable;
                     _currentIndex = _upperPlayerCardsOnBoard.Count - 1;
                 }
                 else
                 {
                     _currentIndex--;
                 }
             }
             else if (_currentPlayer == Player.LowerPlayer && _currentZone == GameZone.CardsOnTable)
             {
                 if (_currentIndex == 0)
                 {
                     _currentZone = GameZone.CardsInHands;
                     _currentIndex = _lowerPlayerCardsInHand.Count - 1;
                 }
                 else
                 {
                     _currentIndex--;
                 }
             }
             else if (_currentPlayer == Player.LowerPlayer && _currentZone == GameZone.CardsInHands)
             {
                 if (_currentIndex == 0)
                 {
                     _currentZone = GameZone.CardsOnTable;
                     _currentIndex = _lowerPlayerCardsOnBoard.Count - 1;
                 }
                 else
                 {
                     _currentIndex--;
                 }
             }
             Print(_currentPlayer, _currentZone, _currentIndex);
         }
         if (pressedKey.Key == ConsoleKey.DownArrow)
         {
             if (_currentPlayer == Player.UpperPlayer && _currentZone == GameZone.CardsOnTable)
             {
                 if (_currentIndex == _upperPlayerCardsInHand.Count - 1)
                 {
                     _currentZone = GameZone.CardsInHands;
                     _currentIndex = 0;
                 }
                 else
                 {
                     _currentIndex++;
                 }
             }
             else if (_currentPlayer == Player.UpperPlayer && _currentZone == GameZone.CardsInHands)
             {
                 if (_currentIndex == _upperPlayerCardsOnBoard.Count - 1)
                 {
                     _currentZone = GameZone.CardsOnTable;
                     _currentIndex = 0;
                 }
                 else
                 {
                     _currentIndex++;
                 }
             }
             else if (_currentPlayer == Player.LowerPlayer && _currentZone == GameZone.CardsOnTable)
             {
                 if (_currentIndex == _lowerPlayerCardsInHand.Count - 1)
                 {
                     _currentZone = GameZone.CardsInHands;
                     _currentIndex = 0;
                 }
                 else
                 {
                     _currentIndex++;
                 }
             }
             else if (_currentPlayer == Player.LowerPlayer && _currentZone == GameZone.CardsInHands)
             {
                 if (_currentIndex == _lowerPlayerCardsOnBoard.Count - 1)
                 {
                     _currentZone = GameZone.CardsOnTable;
                     _currentIndex = 0;
                 }
                 else
                 {
                     _currentIndex++;
                 }
             }
             Print(_currentPlayer, _currentZone, _currentIndex);
         }
         if (pressedKey.Key == ConsoleKey.Enter)
         {
             if (_currentPlayer == Player.UpperPlayer)
             {
                 _currentPlayer = Player.LowerPlayer;
                 _currentZone = GameZone.CardsOnTable;
                 _currentIndex = 0;
             }
             else if (_currentPlayer == Player.LowerPlayer)
             {
                 _currentPlayer = Player.UpperPlayer;
                 _currentZone = GameZone.CardsOnTable;
                 _currentIndex = 0;
             }
             Print(_currentPlayer, _currentZone, _currentIndex);
         }
     }
 }
Ejemplo n.º 6
0
 public void Print(Player playerNumber, GameZone typeOfAction, int index)
 {
     Console.Clear();
     if (playerNumber == Player.UpperPlayer)
     {
         if (typeOfAction == GameZone.CardsOnTable)
         {
             PrintUpperPlayer(index);
             PrintActiveArea(_upperPlayerCardsInHand, -1);
         }
         else
         {
             PrintUpperPlayer(-1);
             PrintActiveArea(_upperPlayerCardsInHand, index);
         }
         PrintLowerPlayer(-1);
     }
     else
     {
         PrintUpperPlayer(-1);
         if (typeOfAction == GameZone.CardsOnTable)
         {
             PrintActiveArea(_lowerPlayerCardsInHand, -1);
             PrintLowerPlayer(index);
         }
         else
         {
             PrintActiveArea(_lowerPlayerCardsInHand, index);
             PrintLowerPlayer(-1);
         }
     }
 }
Ejemplo n.º 7
0
 private bool getPlayer()
 {
     if (playerToFollow != null)
         return true;
     foreach (PhysicalObject2D moveableSprite in World._movableSprites)
     {
         if (moveableSprite.GetType() == typeof(Player))
         {
             playerToFollow = (Player)moveableSprite;
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 8
0
 private void KillOnHit(Player player)
 {
     player.Kill();
 }