Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //_mViewMgr
            _mViewMgr = new ViewportMgr();
            //_mInputMgr
            _mInputMgr = new InputMgr();

            //Add Dedicated listeners
            IDedicatedListener temporaryMgr = (IDedicatedListener)_mViewMgr;

            _mInputMgr.AddDedicatedListener(temporaryMgr);

            IDedicatedListener tempGame = (IDedicatedListener)this;

            _mInputMgr.AddDedicatedListener(tempGame);

            _mEntArray = _mLevel.Populate(_mEntityMgr);


            foreach (IEntity tempEnt in _mEntArray)
            {
                _mSceneMgr.Add(tempEnt);
                _mCollisionMgr.AddCollider(tempEnt);
                _mMindBuilder.BuildMind(tempEnt);
                _mInputMgr.AddInputListener(tempEnt);
                _mViewMgr.AddTarget(tempEnt);
            }
        }
Exemplo n.º 2
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
            //screen width and height

            ScreenHeight = GraphicsDevice.Viewport.Height;
            ScreenWidth  = GraphicsDevice.Viewport.Width;
            //_mSceneMgr
            _mSceneMgr = new SceneMgr();

            //_mEntityMgr
            _mEntityMgr = new EntityMgr(Content);

            //_mEntArray
            _mEntArray = new List <IEntity>();

            //_mCollisionMgr
            _mCollisionMgr = new CollisionMgr();

            //_mAIMgr
            _mAIMgr = new AIMgr();

            //_mMindBuilder
            _mMindBuilder = new MindBuilder(_mAIMgr);

            //_mInputMgr
            _mInputMgr = new InputMgr();

            //_mRenderMgr
            _mRenderMgr = new RenderMgr(Content, GraphicsDevice);

            //_mViewMgr
            _mViewMgr = new ViewportMgr();

            //_mCamera
            _mCamera = new Camera();

            //_mLevel
            _mLevel = new Level2();
            base.Initialize();

            graphics.PreferredBackBufferHeight = ScreenHeight / 2;
            graphics.PreferredBackBufferWidth  = ScreenWidth / 2;
        }