本文整理汇总了C#中IEntityFactory.CreateExampleEntity方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityFactory.CreateExampleEntity方法的具体用法?C# IEntityFactory.CreateExampleEntity怎么用?C# IEntityFactory.CreateExampleEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityFactory
的用法示例。
在下文中一共展示了IEntityFactory.CreateExampleEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyGameWorld
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");
}
示例2: PROJECT_SAFE_NAMEWorld
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));
}