예제 #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()
        {
            // Initialize the logger system
            DefaultLogger.Initialize(this, "../../../DefaultLog.txt");
            EntityIoLogger.Initialize("../../../IoLogfile.txt");

            // Give the IOC container a refence to the game.
            IocContainer.SetGameReference(this);

            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // Resolve controllers
            _entityController     = IocContainer.Resolve <IEntityController>();
            _renderableController = IocContainer.Resolve <IRenderableController>();
            _aiController         = IocContainer.Resolve <IAiController>();
            _collidableController = IocContainer.Resolve <ICollidableController>();
            _playerController     = IocContainer.Resolve <IInteractiveController>();

            // Resolve messaging system
            _entityMessagingSystem = IocContainer.Resolve <IPriorityMessageQueue>();


            base.Initialize();
        }