/// <summary> /// Allows the Menu to initialize itself /// Sets up references to the managers and camera /// </summary> /// <param name="_sl">Reference to the service locator</param> /// <param name="_cam">Reference to the 2D Camera</param> public virtual void Initialize(IServiceLocator _sl, Camera2D _cam) { mServiceLocator = _sl; mInputManager = mServiceLocator.GetService <IInput_Manager>(); mBackgroundManager = mServiceLocator.GetService <IBackground_Manager>(); mEntityManager = mServiceLocator.GetService <IEntity_Manager>(); mContentManager = mServiceLocator.GetService <IContent_Manager>(); mLevelManger = mServiceLocator.GetService <ILevel_Manager>(); mCam = _cam; //Subscribe(); }
/// <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; }
/// <summary> /// Main Constructor /// </summary> /// <param name="_em">Reference to the Entity Manager</param> public AI_Manager(IEntity_Manager _em, ILevel_Manager _lm) { mEntityManager = _em; mLevelManager = _lm; mAllAI = new Dictionary <int, IBasicAI>(); }
/// <summary> /// SetVars Override /// Sets up Manager References /// </summary> /// <param name="_uid">Unique Entity Identifier</param> /// <param name="_sl">Reference to Service Locator</param> public override void setVars(int _uid, IServiceLocator _sl) { base.setVars(_uid, _sl); mInputManager = _sl.GetService <IInput_Manager>(); mLevelManager = _sl.GetService <ILevel_Manager>(); }