本文整理汇总了C#中Sprite.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Get方法的具体用法?C# Sprite.Get怎么用?C# Sprite.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTrigger
public void CreateTrigger()
{
var trigger = new Sprite(material, new Rectangle(Vector2D.Zero, (Size)Vector2D.One))
{
Color = Color.Red
};
trigger.Add(new TimeTrigger.Data(Color.Red, Color.Gray, 1));
trigger.Start<CollisionTrigger>().Add(new CollisionTrigger.Data(Color.White, Color.Red));
Assert.AreEqual(Vector2D.Zero, trigger.Get<Rectangle>().TopLeft);
Assert.AreEqual(Vector2D.One, trigger.Get<Rectangle>().BottomRight);
}
示例2: HasSomethingToRender
private bool HasSomethingToRender(Sprite sprite)
{
var data = sprite.Get<RenderingData>();
if (data == null)
return false; //ncrunch: no coverage, only happens with broken material data in the Editor
drawArea = data.DrawArea;
uv = data.AtlasUV;
isAtlasRotated = data.IsAtlasRotated;
screen = ScreenSpace.Current;
rotation = sprite.Get<float>();
return data.HasSomethingToRender;
}
示例3: ChangeColorIfTwoRectanglesCollide
public void ChangeColorIfTwoRectanglesCollide()
{
var sprite = new Sprite(material, new Rectangle(0.25f, 0.2f, 0.5f, 0.5f));
sprite.Start<CollisionTrigger>().Add(new CollisionTrigger.Data(Color.Yellow, Color.Blue));
sprite.Get<CollisionTrigger.Data>().SearchTags.Add("Creep");
var sprite2 = new Sprite(material, new Rectangle(0.5f, 0.2f, 0.1f, 0.5f));
sprite2.AddTag("Creep");
}
示例4: ChangingDrawAreaWhenPausedDrawsCorrectly
public void ChangingDrawAreaWhenPausedDrawsCorrectly()
{
Time.IsPaused = true;
var sprite = new Sprite(logoMaterial, new Rectangle(0.1f, 0.1f, 0.2f, 0.2f));
sprite.Center = new Vector2D(0.6f, 0.6f);
AdvanceTimeAndUpdateEntities();
Assert.AreEqual(new Vector2D(0.6f, 0.6f), sprite.Get<RenderingData>().DrawArea.Center);
Time.IsPaused = false;
}
示例5: SetDrawAreaWithoutInterpolation
public void SetDrawAreaWithoutInterpolation()
{
var sprite = new Sprite("DeltaEngineLogoAlpha", Rectangle.Zero);
sprite.SetWithoutInterpolation(Rectangle.One);
sprite.SetWithoutInterpolation(sprite.renderingData);
Assert.AreEqual(Rectangle.One, sprite.DrawArea);
Assert.AreEqual(Rectangle.One, sprite.LastDrawArea);
Assert.AreEqual(sprite.renderingData, sprite.Get<RenderingData>());
}