Exemple #1
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

            // INITIALISE the EntityManager variable
            _entityMgr = new EntityManager();
            // INITIALISE the SceneManager variable
            _sceneMgr = new SceneManager();
            // INITIALISE the CollisionManager variable
            // PASSING IN reference to the SceneMgr.SceneEntitiesDelegate method
            // as well a new QuadTree whos position is set to 0,0 and width and height is the screen width and height
            _collisionMgr = new CollisionManager(_sceneMgr.SceneEntitiesDelegate, _sceneMgr.StaticEntitiesDelegate,
                                                 new QuadTree <IShape>(new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight),
                                                                       1));
            // INITIALISE the MindManager variable
            _mindMgr = new MindManager();
            // INITIALISE the InputManager variable
            _inputMgr = new InputManager(PauseGameState);
            // INITIALISE the level to the first level
            // FUTURE IMPROVEMENT ------ possibly in the future make the level selectable
            _levelX = new SplashScreen();
            // CALL to InjectManagers into the level selected
            (_levelX as IManagerInject).InjectManagers(_entityMgr, _collisionMgr,
                                                       _inputMgr, _sceneMgr, _mindMgr, Content);
            // Give the splash screen a rectangle
            (_levelX as SplashScreen).TitleArea = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            // CALL to Initialise the current level
            _levelX.Initialise();

            base.Initialize();
        }
Exemple #2
0
        /// <summary>
        /// METHOD: InjectManagers, a method which injects the managers of the Engine into the level
        /// </summary>
        /// <param name="pEM"></param>
        /// <param name="pCM"></param>
        /// <param name="pIM"></param>
        /// <param name="pSM"></param>
        /// <param name="pMM"></param>
        public void InjectManagers(IEntityManager pEM, ICollisionManager pCM,
                                   IPublisher pIM, ISceneManager pSM, IMindManager pMM, ContentManager pCntnt)
        {
            _entityManager = pEM;

            _collisionManager = pCM;

            _inputManager = pIM;

            _sceneManager = pSM;

            _mindManager = pMM;

            _contentManager = pCntnt;
        }