Inheritance: IComponent
示例#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()
        {
            IsFixedTimeStep = true;
            _gameServer = new GameServer(this);
            _gameServer.Start();

            _lineTexture = new Texture2D(GraphicsDevice, 1, 1);
            _lineTexture.SetData<Color>(
            new Color[] { Color.White });// fill the texture with white

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            var viewMap = Content.Load<TiledMap>("new_map");
            _mapEntity = ObjectMapper.CreateEntityById();
            var mapComponent = new MapComponent();
            mapComponent.Map = viewMap;
            mapComponent.Device = GraphicsDevice;
            mapComponent.Texture = Content.Load<Texture2D>("roguelikeSheet_transparent");
            _mapEntity.AddComponent(mapComponent);

            var mapData = (MapData)ObjectMapper.Create((uint)_mapEntity.UniqueId, typeof(MapData));
            mapData.Load(_gameServer, viewMap);

            _font = Content.Load<BitmapFont>("hack_font");
        }
示例#2
0
文件: Game1.cs 项目: enBask/Asgard
 private void BuildWorld()
 {
     _mapEntity = ObjectMapper.CreateEntityById();
     var mapComponent = new MapComponent();
     mapComponent.Device = GraphicsDevice;
     mapComponent.Texture = Content.Load<Texture2D>("roguelikeSheet_transparent");
     _mapEntity.AddComponent(mapComponent);
 }