本文整理汇总了C#中OpenRA.Graphics.WorldRenderer.Screen3DPxPosition方法的典型用法代码示例。如果您正苦于以下问题:C# WorldRenderer.Screen3DPxPosition方法的具体用法?C# WorldRenderer.Screen3DPxPosition怎么用?C# WorldRenderer.Screen3DPxPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Graphics.WorldRenderer
的用法示例。
在下文中一共展示了WorldRenderer.Screen3DPxPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(WorldRenderer wr)
{
var iz = 1 / wr.Viewport.Zoom;
var screenPos = wr.Screen3DPxPosition(pos);
var tl = screenPos + new float2(visualBounds.Left, visualBounds.Top);
var br = screenPos + new float2(visualBounds.Right, visualBounds.Bottom);
var tr = new float3(br.X, tl.Y, screenPos.Z);
var bl = new float3(tl.X, br.Y, screenPos.Z);
var u = new float2(4 * iz, 0);
var v = new float2(0, 4 * iz);
var wcr = Game.Renderer.WorldRgbaColorRenderer;
wcr.DrawLine(new[] { tl + u, tl, tl + v }, iz, color, true);
wcr.DrawLine(new[] { tr - u, tr, tr + v }, iz, color, true);
wcr.DrawLine(new[] { br - u, br, br - v }, iz, color, true);
wcr.DrawLine(new[] { bl + u, bl, bl - v }, iz, color, true);
}
示例2: Render
public void Render(WorldRenderer wr)
{
if (!actor.IsInWorld || actor.IsDead)
return;
var health = actor.TraitOrDefault<IHealth>();
var screenPos = wr.Screen3DPxPosition(pos);
var bounds = actor.VisualBounds;
bounds.Offset((int)screenPos.X, (int)screenPos.Y);
var start = new float3(bounds.Left + 1, bounds.Top, screenPos.Z);
var end = new float3(bounds.Right - 1, bounds.Top, screenPos.Z);
if (DisplayHealth)
DrawHealthBar(wr, health, start, end);
if (DisplayExtra)
DrawExtraBars(wr, start, end);
}
示例3: RenderDebugGeometry
public void RenderDebugGeometry(WorldRenderer wr)
{
var size = font.Measure(text).ToFloat2();
var offset = wr.Screen3DPxPosition(pos) - 0.5f * size;
Game.Renderer.WorldRgbaColorRenderer.DrawRect(offset, offset + size, 1 / wr.Viewport.Zoom, Color.Red);
}