本文整理匯總了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);
}