本文整理汇总了C#中System.Entity.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Delete方法的具体用法?C# Entity.Delete怎么用?C# Entity.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.Delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public override void Process(Entity e)
{
Health h = healthMapper.Get(e);
if (h == null)
return;
if (e.HasComponent<Origin>())
{
Origin o = e.GetComponent<Origin>();
Entity parent = o.Parent;
if (!parent.HasComponent<Body>() || !parent.GetComponent<Health>().IsAlive)
{
if (e.HasComponent<Health>())
e.GetComponent<Health>().SetHealth(e, 0);
else
e.Delete();
}
}
if (!h.IsAlive)
{
h.SetHealth(e, 0);
e.Delete();
}
}
示例2: Process
/// <summary>
/// Renders all entities with a sprite and a transform to the screen.
/// </summary>
/// <param name="e"></param>
public override void Process(Entity e)
{
try
{
//Get sprite data and transform
ITransform transform = e.GetComponent<ITransform>();
Sprite sprite = e.GetComponent<Sprite>();
if (sprite.Source != null)
//Draw to sprite batch
spriteBatch.Draw(
sprite.SpriteSheet.Texture,
ConvertUnits.ToDisplayUnits(transform.Position),
sprite.CurrentRectangle,
sprite.Color,
transform.Rotation,
sprite.Origin,
sprite.Scale,
SpriteEffects.None, sprite.Layer);
}
catch
{
e.Delete();
Console.WriteLine("Exception try-caught in RenderSystem");
}
}
示例3: Process
public override void Process(Entity e)
{
Body b = e.GetComponent<Body>();
if (b.Position.Y > ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Height) / 2 || Math.Abs(b.Position.X) > ConvertUnits.ToSimUnits(ScreenHelper.Viewport.Width) / 2)
{
e.Delete();
}
}
示例4: Process
public override void Process(Entity e)
{
ITransform t = TransformMapper.Get(e);
if (t == null)
return;
if (Vector2.Distance(t.Position, Vector2.Zero) > bound)
{
e.Delete();
return;
}
if (e.HasComponent<Components.Timer>() && e.GetComponent<Components.Timer>().Update(world.Delta))
{
if (e.Tag == "Boss1")
Console.WriteLine("Whooops");
e.Delete();
}
}
示例5: MoveToMemory
public static void MoveToMemory(Entity i)
{
var obj = new MapObject()
{
Dynamic = !StaticProps.Contains(i.Handle),
Hash = i.Model.Hash,
Position = i.Position,
Quaternion = Quaternion.GetEntityQuaternion(i),
Rotation = i.Rotation,
Type = ObjectTypes.Prop,
};
MemoryObjects.Add(obj);
StreamedInHandles.Remove(i.Handle);
StaticProps.Remove(i.Handle);
i.Delete();
}