//supports mouse picking public MouseManager(Game game, bool bMouseVisible, PhysicsManager physicsManager) : base(game) { this.MouseVisible = bMouseVisible; this.physicsManager = physicsManager; }
private void InitializeManagers(bool isMouseVisible) { this.physicsManager = new PhysicsManager(this, true); Components.Add(physicsManager); this.cameraManager = new CameraManager(this); Components.Add(this.cameraManager); this.keyboardManager = new KeyboardManager(this); Components.Add(this.keyboardManager); this.mouseManager = new MouseManager(this, isMouseVisible); //centre the mouse otherwise the movement for 1st person camera will be unpredictable this.mouseManager.SetPosition(this.screenCentre); Components.Add(this.mouseManager); this.objectManager = new ObjectManager(this, 10, 10, false); this.objectManager.DrawOrder = 1; Components.Add(this.objectManager); this.soundManager = new SoundManager(this, "Content\\Assets\\Audio\\IxchelsQuestAudio.xgs", "Content\\Assets\\Audio\\Wave Bank.xwb", "Content\\Assets\\Audio\\Sound Bank.xsb"); Components.Add(this.soundManager); this.uiManager = new UIManager(this, 10, 10); this.uiManager.DrawOrder = 2; //always draw after object manager(1) Components.Add(this.uiManager); this.textureDictionary.Add("IButton", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioButton")); this.textureDictionary.Add("IButtonHighlighted", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioButtonHighlighted")); this.textureDictionary.Add("IAudio", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenu")); this.textureDictionary.Add("IAudioMenuMusic", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuMusic")); this.textureDictionary.Add("IAudioMenuMute", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuMute")); this.textureDictionary.Add("IAudioMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuReturn")); this.textureDictionary.Add("IAudioMenuSFX", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuSFX")); this.textureDictionary.Add("IControlsMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/ControlsMenu")); this.textureDictionary.Add("IControlsMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/ControlsMenuReturn")); this.textureDictionary.Add("IMainMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenu")); this.textureDictionary.Add("IMainMenuOptions", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenuOptions")); this.textureDictionary.Add("IMainMenuQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenuQuit")); this.textureDictionary.Add("IMainMEnuStart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMEnuStart")); this.textureDictionary.Add("IOptionsMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenu")); this.textureDictionary.Add("IOptionsMenuAudio", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuAudio")); this.textureDictionary.Add("IOptionsMenuControls", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuControls")); this.textureDictionary.Add("IOptionsMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuReturn")); this.textureDictionary.Add("IPauseMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenu")); this.textureDictionary.Add("IPauseMenuOptions", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuOptions")); this.textureDictionary.Add("IPauseMenuQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuQuit")); this.textureDictionary.Add("IPauseMenuRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuRestart")); this.textureDictionary.Add("IPauseMenuResume", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuResume")); this.textureDictionary.Add("IYouLose", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLose")); this.textureDictionary.Add("IYouLoseQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLoseQuit")); this.textureDictionary.Add("IYouLoseRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLoseRestart")); this.textureDictionary.Add("IYouWin", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWin")); this.textureDictionary.Add("IYouWinQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWinQuit")); this.textureDictionary.Add("IYouWinRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWinRestart")); this.textureDictionary.Add("IX", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/X")); Texture2D[] menuTexturesArray = { this.textureDictionary["IButton"], this.textureDictionary["IButtonHighlighted"], this.textureDictionary["IAudio"], this.textureDictionary["IAudioMenuMusic"], this.textureDictionary["IAudioMenuMute"], this.textureDictionary["IAudioMenuReturn"], this.textureDictionary["IAudioMenuSFX"], this.textureDictionary["IControlsMenu"], this.textureDictionary["IControlsMenuReturn"], this.textureDictionary["IMainMenu"], this.textureDictionary["IMainMenuOptions"], this.textureDictionary["IMainMenuQuit"], this.textureDictionary["IMainMEnuStart"], this.textureDictionary["IOptionsMenu"], this.textureDictionary["IOptionsMenuAudio"], this.textureDictionary["IOptionsMenuControls"], this.textureDictionary["IOptionsMenuReturn"], this.textureDictionary["IPauseMenu"], this.textureDictionary["IPauseMenuOptions"], this.textureDictionary["IPauseMenuQuit"], this.textureDictionary["IPauseMenuRestart"], this.textureDictionary["IPauseMenuResume"], this.textureDictionary["IYouLose"], this.textureDictionary["IYouLoseQuit"], this.textureDictionary["IYouLoseRestart"], this.textureDictionary["IYouWin"], this.textureDictionary["IYouWinQuit"], this.textureDictionary["IYouWinRestart"], this.textureDictionary["IX"] }; this.menuManager = new MenuManager(this, menuTexturesArray, this.fontDictionary["menu"], MenuData.MenuTexturePadding, MenuData.MenuTextureColor); this.menuManager.DrawOrder = 3; //always draw after ui manager(2) Components.Add(this.menuManager); }