Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            collisionManager = (ICollisionManager)Game.Services.GetService(typeof(ICollisionManager));
            camera = (GameCamera)Game.Services.GetService(typeof(GameCamera));

            Game.Services.AddService(typeof(ITilemapRenderer), this);

            if (map != null)
                foreach (TaggedVector p in map.CollidableTiles)
                    collisionManager.AddTile(p.Position, (Tile)p.Identifier);

            base.Initialize();
        }