예제 #1
0
        /// <summary>
        /// override method for the guest'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;
        }
예제 #2
0
 /// <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)
 {
     _myPlayer = myPlayer;
     _hall = hall;
     _guestList = guests;
     _staffList = staff;
     InitializeConsoleWindow();
 }
        // TODO Sprint 2 Mod 11 - create a method to process the user's action choice
        /// <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;
            }
        }
        /// <summary>
        /// initialize the player wtth their properities
        /// </summary>
        private void InitializePlayer()
        {
            _myPlayer = new Player(
                "Bonzo",
                Player.GenderType.Female,
                Player.RaceType.Human,
                1);

            // TODO Sprint 2 Mod 02 - initialize InHall property
            _myPlayer.InHall = true;
        }