本文整理汇总了C#中Entity.AddComponentFromPool方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.AddComponentFromPool方法的具体用法?C# Entity.AddComponentFromPool怎么用?C# Entity.AddComponentFromPool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.AddComponentFromPool方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildEntity
public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
{
PhysicsBody body = entity.AddComponentFromPool<SPShared.ECS.Components.PhysicsBody>();
body.Body.Shape = shipShape;
PhysicsSystem physicsSystem = entityWorld.SystemManager.GetSystem<PhysicsSystem>();
physicsSystem.AddBody(body);
physicsSystem.AddConstraint(new Constraint2D(body.Body));
return entity;
}
示例2: BuildEntity
public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
{
e.Group = "EFFECTS";
e.AddComponentFromPool<Transform>();
e.AddComponent(new SpatialForm());
e.AddComponent(new Expires());
e.GetComponent<SpatialForm>().SpatialFormFile = "ShipExplosion";
e.GetComponent<Expires>().LifeTime = 1000;
return e;
}
示例3: BuildEntity
public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
{
e.Group = "BULLETS";
e.AddComponentFromPool<Transform>();
e.AddComponent(new SpatialForm());
e.AddComponent(new Velocity());
e.AddComponent(new Expires());
e.GetComponent<SpatialForm>().SpatialFormFile = "Missile";
e.GetComponent<Expires>().LifeTime = 2000;
return e;
}
示例4: BuildEntity
public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
{
e.Group = "SHIPS";
e.AddComponentFromPool<Transform>();
e.AddComponent(new SpatialForm());
e.AddComponent(new Health());
e.AddComponent(new Weapon());
e.AddComponent(new Enemy());
e.AddComponent(new Velocity());
e.GetComponent<SpatialForm>().SpatialFormFile = "EnemyShip";
e.GetComponent<Health>().HP = 10;
return e;
}