コード例 #1
0
        /// <summary>
        /// players turn METHOD
        /// </summary>
        /// <param name="board"></param>
        /// <param name="deck"></param>
        /// <returns></returns>
        public string TakeTurn(Game_Board board, CardDeck deck)
        {
            //skip with licoris
            if (IsSkipped)
            {
                IsSkipped = false;
                return(Name + "was skipped");
            }
            var card          = deck.Draw();
            int matchingIndex = CurrentLocation;
            var space         = board.Spaces.GetMatchingSpace(CurrentLocation, card);

            CurrentLocation = space.Position;             //move to the space defined by the card drawn
            string message = Name + " moved to Space " + CurrentLocation.ToString() + " which is a " + space.Color.ToString() + " space";

            //Player is stuck

            if (space.IsLicorice)
            {
                IsSkipped = true;
                message  += Name + " is stuck in Licorice";
            }

            if (space.ShortcutDesination.HasValue)             // Player Landed on shortcut
            {
                CurrentLocation = space.ShortcutDesination.Value;
                message        += Name + " took a shortcut to space " + CurrentLocation.ToString() + "!";
            }

            //palyer won the game

            if (CurrentLocation == 133)
            {
                IsWinner = true;
                message += Name + " has won the game";
            }
            return(message);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: dnmueller19/CandyLand
 public Game()
 {
     Board   = new Game_Board();
     Deck    = new CardDeck();
     Players = new List <Players>();
 }