public MyGameWorld( I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, IEntityFactory entityFactory) { this.Entities = new List <IEntity>(); _renderUtilities = renderUtilities; _assetManager = assetManagerProvider.GetAssetManager(); _defaultFont = this._assetManager.Get <FontAsset>("font.Default"); // You can also save the entity factory in a field and use it, e.g. in the Update // loop or anywhere else in your game. var entityA = entityFactory.CreateExampleEntity("EntityA"); entityA.X = 100; entityA.Y = 50; var entityB = entityFactory.CreateExampleEntity("EntityB"); entityB.X = 120; entityB.Y = 100; // Don't forget to add your entities to the world! this.Entities.Add(entityA); this.Entities.Add(entityB); // This pulls in the texture asset via the asset manager. Note that // the folder seperator from "texture/Player" has been translated // into a single dot. _playerTexture = _assetManager.Get <TextureAsset>("texture.Player"); }
public MyGameWorld( I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, IEntityFactory entityFactory) { this.Entities = new List<IEntity>(); _renderUtilities = renderUtilities; _assetManager = assetManagerProvider.GetAssetManager(); _defaultFont = this._assetManager.Get<FontAsset>("font.Default"); // You can also save the entity factory in a field and use it, e.g. in the Update // loop or anywhere else in your game. var entityA = entityFactory.CreateExampleEntity("EntityA"); entityA.X = 100; entityA.Y = 50; var entityB = entityFactory.CreateExampleEntity("EntityB"); entityB.X = 120; entityB.Y = 100; // Don't forget to add your entities to the world! this.Entities.Add(entityA); this.Entities.Add(entityB); // This pulls in the texture asset via the asset manager. Note that // the folder seperator from "texture/Player" has been translated // into a single dot. _playerTexture = _assetManager.Get<TextureAsset>("texture.Player"); }
public PROJECT_SAFE_NAMEWorld( INode worldNode, IHierarchy hierarchy, I2DRenderUtilities twoDRenderUtilities, IAssetManagerProvider assetManagerProvider, IEntityFactory entityFactory) { this.Entities = new List<IEntity>(); _renderUtilities = twoDRenderUtilities; _assetManager = assetManagerProvider.GetAssetManager(); _defaultFont = this._assetManager.Get<FontAsset>("font.Default"); // You can also save the entity factory in a field and use it, e.g. in the Update // loop or anywhere else in your game. var entityA = entityFactory.CreateExampleEntity("EntityA"); entityA.Transform.LocalPosition = new Vector3(100, 50, 0); var entityB = entityFactory.CreateExampleEntity("EntityB"); entityB.Transform.LocalPosition = new Vector3(120, 100, 0); // Don't forget to add your entities to the world! hierarchy.MoveNode(worldNode, hierarchy.Lookup(entityA)); hierarchy.MoveNode(worldNode, hierarchy.Lookup(entityB)); }