Beispiel #1
0
        } // end Square constructor

        /// <summary>
        /// Performs the necessary action when a player lands on this type of square.
        ///
        /// Landing on an ordinary square has
        ///    no consequential action to be performed at this time.
        ///
        /// Pre:  the player who lands on this square
        /// Post: none.
        /// </summary>
        /// <param name="player">who landed on this square</param>
        /// <remarks>Virtual method</remarks>
        public virtual void LandOn(Player player)
        {
            // This method is implemented within subclasses of Square
            // perhaps something will be done in a future version of this game
            // for an Ordinary square

            switch (player.Location.Name)
            {
            case "Lottery Win":
                player.Credit(10);
                player.Location = NextSquare;
                break;

            case "Bad Investment":
                player.Debit(25);
                break;

            default:
                break;
            }
        } //end LandOn
        /// <summary>
        /// Implements the action when a player lands on this square.
        /// Debits the bad investment.
        /// </summary>
        /// <param name="player">who landed on the square</param>
        public override void LandOn(Player player)
        {
            base.LandOn(player);  // keep in case of future change

            player.Debit(AMOUNT_TO_BE_DEBITED);
        }
        /// <summary>
        /// Performs the necessary action when a player lands on this type of square.
        /// 
        /// Landing on an ordinary square has
        ///    no consequential action to be performed at this time.
        ///    
        /// Pre:  the player who lands on this square
        /// Post: none.
        /// </summary>
        /// <param name="player">who landed on this square</param>
        /// <remarks>Virtual method</remarks>
        public virtual void LandOn(Player player)
        {
            // This method is implemented within subclasses of Square
            // perhaps something will be done in a future version of this game
            // for an Ordinary square

            switch (player.Location.Name)
            {
                case "Lottery Win":
                    player.Credit(10);
                    player.Location = NextSquare;
                    break;
                case "Bad Investment":
                    player.Debit(25);
                    break;
                default:
                    break;
            }
        }
Beispiel #4
0
        } //end BadInvestmentSquare

        /// <summary>
        /// Implements the action when a player lands on this square.
        /// Debits the bad investment.
        /// </summary>
        /// <param name="player">who landed on the square</param>
        public override void LandOn(Player player)
        {
            base.LandOn(player);  // keep in case of future change

            player.Debit(AMOUNT_TO_BE_DEBITED);
        } //end LandOn
        /// <summary>
        /// Implements the action when a player lands on this square.
        /// Debits the bad investment.
        /// </summary>
        /// <param name="player">who landed on the square</param>
        public override void LandOn(Player player)
        {
            base.LandOn(player);

            player.Debit(AMOUNT_TO_BE_DEBITED);
        }