コード例 #1
0
 /// <summary>
 /// Constructor : Set up the correct default initial game state.
 /// </summary>
 public Game()
 {
     Prologue          = string.Empty;
     HelpText          = string.Empty;
     StartRoom         = null;
     Parser            = new Parser();
     GlobalState       = new GlobalState();
     Difficulty        = DifficultyEnum.Easy;
     HintSystemEnabled = false;
     ContentManagement = new ContentManagement();
     Player            = new Player();
 }
コード例 #2
0
 /// <summary>
 /// Constructor : Set up the correct default initial game state.
 /// </summary>
 public Game()
 {
     Prologue          = string.Empty;
     HelpText          = string.Empty;
     VisitedRooms      = new VisitedRooms();
     Parser            = new Parser();
     StartRoom         = null;
     GlobalState       = new GlobalState();
     Difficulty        = DifficultyEnum.Easy;
     HintSystemEnabled = false;
     ContentManagement = new ContentManagement(true);
     Player            = new Player();
     TextSubstitute    = new TextSubstitute();
 }
コード例 #3
0
        /// <summary>
        /// Constructor : Set up the correct default initial game state.
        /// </summary>
        /// <param name="prologue">You can inject the game prologue text into this constructor.</param>
        /// <param name="room">Set the initial starting room.</param>
        /// <exception cref="ArgumentNullException">If the prologue or initial room is null then throw the
        /// ArgumentNullException.</exception>
        public Game(string prologue, IRoom room)
        {
            if (string.IsNullOrEmpty(prologue))
            {
                throw new ArgumentNullException(nameof(prologue), "The prologue can not be empty.");
            }

            Prologue          = prologue;
            StartRoom         = room ?? throw new ArgumentNullException(nameof(room), "The initial room state can not be null.");
            CurrentRoom       = room;
            HelpText          = string.Empty;
            Parser            = new Parser();
            GlobalState       = new GlobalState();
            Difficulty        = DifficultyEnum.Easy;
            HintSystemEnabled = false;
            ContentManagement = new ContentManagement();
            Player            = new Player();
        }