//StorageDevice device; //string containerName = "GMTBSaveData"; //string filename = "InfirmarySave.sav"; #endregion #region Accessors //public IDictionary<int, IEntity> Entities //{ // get { return mEntities; } //} //public IDictionary<int, IEntity> SceneGraph //{ // get { return mSceneGraph; } //} #endregion #region Constructor /// <summary> /// Main Constructor /// </summary> /// <param name="_em">Reference to the Entity Manager</param> /// <param name="_bm">Reference to the Background manager</param> public Scene_Manager(IEntity_Manager _em, IBackground_Manager _bm) { // Initialise Entity List //mEntities = em.Entities; mEntityManager = _em; mBackgroundManager = _bm; mSceneGraph = new Dictionary <int, IPhysicalEntity>(); mEntities = new Dictionary <int, IEntity>(); }
/// <summary> /// Initialises the level, sets up Manager references /// Then Resumes the level if not already run /// </summary> /// <param name="_sl"> Reference to the Service Locator </param> public virtual void Initialise(IServiceLocator _sl) { mServiceLocator = _sl; mEntityManager = mServiceLocator.GetService <IEntity_Manager>(); mSceneManager = mServiceLocator.GetService <IScene_Manager>(); mBackgroundManager = mServiceLocator.GetService <IBackground_Manager>(); if (!firstRun) { Resume(); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); // Create Input Manager //mInputManager = new Input_Manager(); // Create Service Locator and all Managers mServiceLocator = new ServiceLocator(Content, mContentRoot, mLevels, mMenus); // Retrive Managers required mSceneManager = mServiceLocator.GetService <IScene_Manager>(); mCollisionManager = mServiceLocator.GetService <ICollision_Manager>(); mInputManager = mServiceLocator.GetService <IInput_Manager>(); mAIManager = mServiceLocator.GetService <IAI_Manager>(); mMenuManager = mServiceLocator.GetService <IMenu_Manager>(); mLevelManager = mServiceLocator.GetService <ILevel_Manager>(); mBackgroundManager = mServiceLocator.GetService <IBackground_Manager>(); if (mCamera != null) { mCamera.Intialize(mServiceLocator); mMenuManager.ConfigureCamera(mCamera); } Console.WriteLine("Max Texture Size: " + CalculateMaxTextureSize()); // Create Content Manager, pass Monogame Content Manager and Path to Content Root //mContentManager = new Content_Manager(Content, mContentRoot); //mContentManager = mServiceLocator.GetService<IContent_Manager>(); // Create Background Manager, pass Content Manager //mBackgroundManager = new Background_Manager(mContentManager); // Create Entity Manager, pass Content and Input Managers //mEntityManager = new Entity_Manager(mServiceLocator, mContentManager, mInputManager); // Create Scene Manager, pass Entity and Background Managers //mSceneManager = new Scene_Manager(mEntityManager, mBackgroundManager); // Create Collision Manager, pass Entity Manager and Screen Size variables //mCollisionMananger = new Collision_Manager(mEntityManager, new Point(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height)); // Create AI Manager, Pass the Entity Manager //mAIManager = new AI_Manager(mEntityManager); // Initialise first Level, pass Scene, Entity and Background Managers // mLevels[0].Initialise(mSceneManager, mEntityManager, mBackgroundManager); mMenuManager.InitializeMenus(); mMenuManager.ActivateMenu("main"); Global.GameState = Global.availGameStates.Menu; }