public Controller()
        {
            InitializeGame();

            //
            // instantiate a Salesperson object
            //
            _gameOgre = new Ogre();

            //
            // instantiate a ConsoleView object
            //
            _gameConsoleView = new ConsoleView(_gameOgre, _gameKingdom);

            //
            // begins running the application UI
            //
            ManageGameLoop();
        }
Exemplo n.º 2
0
        /// <summary>
        /// initialize the major game objects
        /// </summary>
        private void InitializeGame()
        {
            _gameSurvivor    = new Survivor();
            _worldContents   = new WorldContents();
            _gameConsoleView = new ConsoleView(_gameSurvivor, _worldContents);
            _gameConsoleView.DisplayStatusBox();
            SurvivorObject survivorObject;
            Friendly       friendly;

            _playingGame = true;

            //add event handler for adding/subtracting to/from inventory
            foreach (GameObject gameObject in _worldContents.GameObjects)
            {
                if (gameObject is SurvivorObject)
                {
                    survivorObject = gameObject as SurvivorObject;
                    survivorObject.ObjectAddedToInventory += HandleObjectAddedToInventory;
                }
            }

            //event handler for speaking with and unlocking room
            foreach (Npc npc in _worldContents.Npcs)
            {
                if (npc is Friendly)
                {
                    friendly = npc as Friendly;
                    friendly.FriendlyTalkedTo += HandleNpcTalkedTo;
                }
            }

            //add initial items to the survivor's inventory
            _gameSurvivor.Inventory.Add(_worldContents.GetGameOjbectById(5) as SurvivorObject);
            _gameSurvivor.Inventory.Add(_worldContents.GetGameOjbectById(6) as SurvivorObject);

            Console.CursorVisible = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// initialize the major game objects
        /// </summary>
        private void InitializeGame()
        {
            _gamePlayer      = new Prospector();
            _gameUniverse    = new Universe();
            _gameConsoleView = new ConsoleView(_gamePlayer, _gameUniverse);
            _playingGame     = true;
            ProspectorObject prospectorObject;

            foreach (GameObject gameObject in _gameUniverse.GameObjects)
            {
                if (gameObject is ProspectorObject)
                {
                    prospectorObject = gameObject as ProspectorObject;
                    prospectorObject.objectAddedToInventory += HandleObjectAddedToInventory;
                }
            }

            //
            //add initial items to the travelers inventory
            //
            _gamePlayer.Inventory.Add(_gameUniverse.GetGameObjectById(1) as ProspectorObject);

            Console.CursorVisible = false;
        }
Exemplo n.º 4
0
 public Controller()
 {
     universe = new Universe();
     view     = new ConsoleView();
     Initialize();
 }