public ScrapHeap() { settings = new GameSettings(); screenManager = new ScreenManager(); graphics = new GraphicsDeviceManager(this); interpreter = new CommandInterpreter(); controlSystem = new ControlSystem(); menu = new Menu(); console = new GameConsole(); Content.RootDirectory = "Content"; player = new Player("Player", Vector3.Zero, Vector3.Zero); collisionSystem = new CollisionSystem(); entitySystem = new EntitySystem(); }
// initialize the menu public void initialize(GameSettings settings, CommandInterpreter interpreter) { m_settings = settings; m_interpreter = interpreter; // add all sub-menus to the sub-menu collection m_menu.Add(new MainMenu(this, m_position, m_titleColour, m_selectedItemColour, m_unselectedItemColour, m_arrowColour)); m_menu.Add(new GameSinglePlayerMenu(this, m_position, m_titleColour, m_selectedItemColour, m_unselectedItemColour, m_arrowColour)); // initialize all sub-menus for (int i = 0; i < m_menu.Count(); i++) { m_menu[i].initialize(m_interpreter); } }
// initialize the control system public void initialize(GameSettings settings, CommandInterpreter interpreter) { m_settings = settings; m_interpreter = interpreter; // get the list of controls from the settings file manager List <Variable> controlVariables = settings.getControls(); // create the key bindings based on these controls for (int i = 0; i < controlVariables.Count(); i++) { string key = controlVariables[i].id; string cmd = controlVariables[i].value; createKeyBind(key, cmd); } }
// initialize the sub-menu public virtual void initialize(CommandInterpreter interpreter) { m_interpreter = interpreter; }