Fix IDE0032
This commit is contained in:
committed by
Pavel Penev
parent
e64c0a35c5
commit
98c4eaca83
@@ -16,9 +16,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
public class DetectionCircleAnnotationRenderable : IRenderable, IFinalizedRenderable
|
||||
{
|
||||
readonly WPos centerPosition;
|
||||
readonly WDist radius;
|
||||
readonly int zOffset;
|
||||
readonly int trailCount;
|
||||
readonly WAngle trailSeparation;
|
||||
readonly WAngle trailAngle;
|
||||
@@ -30,9 +28,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public DetectionCircleAnnotationRenderable(WPos centerPosition, WDist radius, int zOffset,
|
||||
int lineTrails, WAngle trailSeparation, WAngle trailAngle, Color color, float width, Color borderColor, float borderWidth)
|
||||
{
|
||||
this.centerPosition = centerPosition;
|
||||
Pos = centerPosition;
|
||||
this.radius = radius;
|
||||
this.zOffset = zOffset;
|
||||
ZOffset = zOffset;
|
||||
trailCount = lineTrails;
|
||||
this.trailSeparation = trailSeparation;
|
||||
this.trailAngle = trailAngle;
|
||||
@@ -42,19 +40,19 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.borderWidth = borderWidth;
|
||||
}
|
||||
|
||||
public WPos Pos => centerPosition;
|
||||
public int ZOffset => zOffset;
|
||||
public WPos Pos { get; }
|
||||
public int ZOffset { get; }
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset)
|
||||
{
|
||||
return new DetectionCircleAnnotationRenderable(centerPosition, radius, newOffset,
|
||||
return new DetectionCircleAnnotationRenderable(Pos, radius, newOffset,
|
||||
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||
}
|
||||
|
||||
public IRenderable OffsetBy(in WVec vec)
|
||||
{
|
||||
return new DetectionCircleAnnotationRenderable(centerPosition + vec, radius, zOffset,
|
||||
return new DetectionCircleAnnotationRenderable(Pos + vec, radius, ZOffset,
|
||||
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||
}
|
||||
|
||||
@@ -64,19 +62,19 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public void Render(WorldRenderer wr)
|
||||
{
|
||||
var cr = Game.Renderer.RgbaColorRenderer;
|
||||
var center = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(centerPosition));
|
||||
var center = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(Pos));
|
||||
|
||||
for (var i = 0; i < trailCount; i++)
|
||||
{
|
||||
var angle = trailAngle - new WAngle(i * (trailSeparation.Angle <= 512 ? 1 : -1));
|
||||
var length = radius.Length * new WVec(angle.Cos(), angle.Sin(), 0) / 1024;
|
||||
var end = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(centerPosition + length));
|
||||
var end = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(Pos + length));
|
||||
var alpha = color.A - i * color.A / trailCount;
|
||||
cr.DrawLine(center, end, borderWidth, Color.FromArgb(alpha, borderColor));
|
||||
cr.DrawLine(center, end, width, Color.FromArgb(alpha, color));
|
||||
}
|
||||
|
||||
RangeCircleAnnotationRenderable.DrawRangeCircle(wr, centerPosition, radius, width, color, borderWidth, borderColor);
|
||||
RangeCircleAnnotationRenderable.DrawRangeCircle(wr, Pos, radius, width, color, borderWidth, borderColor);
|
||||
}
|
||||
|
||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||
|
||||
Reference in New Issue
Block a user