Ejemplo n.º 1
0
 /// <summary>
 /// Main Constructor
 /// </summary>
 /// <param name="_sl">Reference to the Service Locator</param>
 /// <param name="_menus">Pass all loaded menus here</param>
 public Menu_Manager(IServiceLocator _sl, IDictionary <string, IMenu> _menus)
 {
     mServiceLocator = _sl;
     mInputManager   = mServiceLocator.GetService <IInput_Manager>();
     mInputManager.Sub_Esc(OnEsc);
     mMenus = _menus;
 }
Ejemplo n.º 2
0
 /// <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();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Main Constructor
        /// </summary>
        /// <param name="_sl">Reference to Service Locator</param>
        /// <param name="_lines">Lines to display</param>
        /// <param name="_path">Character art path</param>
        /// <param name="_pos">Character art position</param>
        /// <param name="_speaker">Reference to the speaker</param>
        public DialogueDisplay(IServiceLocator _sl, string[] _lines, string _path, ISpeaker _speaker)
        {
            mLines = _lines;

            mInterval       = 3000f;
            mTimer          = 0f;
            mDialogueBox    = new DialogueBox(_sl);
            mInputManager   = _sl.GetService <IInput_Manager>();
            mContentManager = _sl.GetService <IContent_Manager>();
            mArtpath        = _path;
            mSpeaker        = _speaker;
        }
Ejemplo n.º 4
0
        /// <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;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initialize the state
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            mInputManager = mPMind.ServiceLocator.GetService <IInput_Manager>();
            // Set intial facing direction
            switch (mPMind.MySelf.Texturename)
            {
            case "Characters/Player/standR":
                mPMind.MySelf.FacingDirection = "right";
                break;

            case "Characters/Player/standL":
                mPMind.MySelf.FacingDirection = "left";
                break;
            }
            Reactivate();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Method to configure if an entity requires input detection.
 /// Uses Service Locator to access Input Manager.
 /// Override and specify which events to listen for.
 /// </summary>
 public virtual void ConfigureInput()
 {
     mInputManager = mServiceLocator.GetService <IInput_Manager>();
 }