示例#1
0
        /// <summary>
        /// override method for the staff's greeting
        /// </summary>
        /// <returns>greeting string</returns>
        public string Greeting(Player player)
        {
            string greeting;
            greeting = string.Format("Hello, my name is {1}. {3}", _name, _initialGreeting);

            return greeting;
        }
 // TODO Sprint 3 Mod 05b - modify the ConsoleView constructor to accept the treasure object
 /// <summary>
 /// constructor to create the console view, send all major data objects
 /// </summary>
 /// <param name="myPlayer">active player object</param>
 /// <param name="hall">current hall object</param>
 /// <param name="hall">current guest list object</param>
 public ConsoleView(Player myPlayer, Hall hall, GuestList guests, StaffList staff, Treasure treasure)
 {
     _myPlayer = myPlayer;
     _hall = hall;
     _guestList = guests;
     _staffList = staff;
     _treasure = treasure;
     InitializeConsoleWindow();
 }
        /// <summary>
        /// initialize the player wtth their properities
        /// </summary>
        private void InitializePlayer()
        {
            _myPlayer = new Player(
                "Bonzo",
                Player.GenderType.Female,
                Player.RaceType.Human,
                1);

            _myPlayer.InHall = true;

            // TODO Sprint 3 Mod 09 - give the player some coins at the start of the game
            // TOOD Sprint 3 Mod 09! - handle magic numbers
            // give the player some money at the start of the game
            CoinGroup smallGoldCoins = new CoinGroup()
            {
                Quantity = 2,
                CoinType = _treasures.CoinTypes[0]
            };
            CoinGroup smallSilverCoins = new CoinGroup()
            {
                Quantity = 10,
                CoinType = _treasures.CoinTypes[1]
            };
            CoinGroup smallBronzeCoins = new CoinGroup()
            {
                Quantity = 20,
                CoinType = _treasures.CoinTypes[2]
            };

            _myPlayer.Coins.Add(smallGoldCoins);
            _myPlayer.Coins.Add(smallSilverCoins);
            _myPlayer.Coins.Add(smallBronzeCoins);

            // TODO Sprint 3 Mod 23 - give the player some weapons at the beginning of the game
            // give the player some weapons at the beginning of the game
            _myPlayer.Weapons.Add(
                new Weapon
                {
                    Type = Weapon.WeaponType.gun,
                    Name = "Thompson Submachine Gun",
                    Description = "Fast firing submachine gun with a 50 shell mag"
                });

            _myPlayer.Weapons.Add(
                new Weapon
                {
                    Type = Weapon.WeaponType.knife,
                    Name = "Bowie Knife",
                    Description = "Really big knife"
                });
        }
        /// <summary>
        /// process the user's action choice
        /// </summary>
        /// <param name="playerActionChoice">playerActionChoice</param>
        private void ImplementPlayerAction(Player.ActionChoice playerActionChoice)
        {
            switch (playerActionChoice)
            {
                case Player.ActionChoice.None:
                    throw new System.ArgumentException("None is and invalid ActionChoice", "");
                case Player.ActionChoice.QuitGame:
                    _userConsoleView.DisplayExitPrompt();
                    break;
                case Player.ActionChoice.Move:
                    // player moves to hall
                    if (!_myPlayer.InHall)
                    {
                        _myPlayer.InHall = true;

                        _userConsoleView.DisplayHallMessage();
                    }
                    // player chooses room
                    else
                    {
                        int newRoomNumber = _userConsoleView.GetPlayerRoomNumberChoice();

                        _myPlayer.CurrentRoomNumber = newRoomNumber;
                        _myPlayer.InHall = false;
                    }
                    break;
                default:
                    throw new System.ArgumentException("This ActionChoice has not been implemnted in the switch.", "");
                    break;
            }
        }