Initial commit: OpenRA game engine
Fork from OpenRA/OpenRA with one-click launch script (start-ra.cmd) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
121
OpenRA.Mods.Common/HitShapes/Capsule.cs
Normal file
121
OpenRA.Mods.Common/HitShapes/Capsule.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public class CapsuleShape : IHitShape
|
||||
{
|
||||
public WDist OuterRadius { get; private set; }
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly int2 PointA;
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly int2 PointB;
|
||||
|
||||
public readonly WDist Radius = new(426);
|
||||
|
||||
[Desc("Defines the top offset relative to the actor's center.")]
|
||||
public readonly int VerticalTopOffset = 0;
|
||||
|
||||
[Desc("Defines the bottom offset relative to the actor's center.")]
|
||||
public readonly int VerticalBottomOffset = 0;
|
||||
|
||||
int2 ab;
|
||||
int abLenSq;
|
||||
|
||||
public CapsuleShape() { }
|
||||
|
||||
public CapsuleShape(int2 a, int2 b, WDist radius)
|
||||
{
|
||||
PointA = a;
|
||||
PointB = b;
|
||||
Radius = radius;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
ab = PointB - PointA;
|
||||
abLenSq = ab.LengthSquared / 1024;
|
||||
|
||||
if (abLenSq == 0)
|
||||
throw new YamlException("This Capsule describes a circle. Use a Circle HitShape instead.");
|
||||
|
||||
if (VerticalTopOffset < VerticalBottomOffset)
|
||||
throw new YamlException("VerticalTopOffset must be equal to or higher than VerticalBottomOffset.");
|
||||
|
||||
OuterRadius = Radius + new WDist(Math.Max(PointA.Length, PointB.Length));
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var p = new int2(v.X, v.Y);
|
||||
|
||||
var t = int2.Dot(p - PointA, ab) / abLenSq;
|
||||
|
||||
if (t < 0)
|
||||
return new WDist(Math.Max(0, (PointA - p).Length - Radius.Length));
|
||||
if (t > 1024)
|
||||
return new WDist(Math.Max(0, (PointB - p).Length - Radius.Length));
|
||||
|
||||
var projection = PointA + new int2(
|
||||
ab.X * t / 1024,
|
||||
ab.Y * t / 1024);
|
||||
|
||||
var distance = (projection - p).Length;
|
||||
|
||||
return new WDist(Math.Max(0, distance - Radius.Length));
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation)
|
||||
{
|
||||
if (pos.Z > origin.Z + VerticalTopOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalTopOffset))).Rotate(-orientation));
|
||||
|
||||
if (pos.Z < origin.Z + VerticalBottomOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalBottomOffset))).Rotate(-orientation));
|
||||
|
||||
return DistanceFromEdge((pos - new WPos(origin.X, origin.Y, pos.Z)).Rotate(-orientation));
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IHitShape.RenderDebugOverlay(HitShape hs, WorldRenderer wr, WPos origin, WRot orientation)
|
||||
{
|
||||
var a = origin + new WVec(PointA.X, PointA.Y, VerticalTopOffset).Rotate(orientation);
|
||||
var b = origin + new WVec(PointB.X, PointB.Y, VerticalTopOffset).Rotate(orientation);
|
||||
var aa = origin + new WVec(PointA.X, PointA.Y, VerticalBottomOffset).Rotate(orientation);
|
||||
var bb = origin + new WVec(PointB.X, PointB.Y, VerticalBottomOffset).Rotate(orientation);
|
||||
|
||||
var offset1 = new WVec(a.Y - b.Y, b.X - a.X, 0);
|
||||
offset1 = offset1 * Radius.Length / offset1.Length;
|
||||
var offset2 = new WVec(aa.Y - bb.Y, bb.X - aa.X, 0);
|
||||
offset2 = offset2 * Radius.Length / offset2.Length;
|
||||
|
||||
var shapeColor = hs.IsTraitDisabled ? Color.LightGray : Color.Yellow;
|
||||
|
||||
yield return new CircleAnnotationRenderable(a, Radius, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(b, Radius, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(aa, Radius, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(bb, Radius, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(origin, OuterRadius, 1, hs.IsTraitDisabled ? Color.Gray : Color.LimeGreen);
|
||||
yield return new LineAnnotationRenderable(a - offset1, b - offset1, 1, shapeColor);
|
||||
yield return new LineAnnotationRenderable(a + offset1, b + offset1, 1, shapeColor);
|
||||
yield return new LineAnnotationRenderable(aa - offset2, bb - offset2, 1, shapeColor);
|
||||
yield return new LineAnnotationRenderable(aa + offset2, bb + offset2, 1, shapeColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
67
OpenRA.Mods.Common/HitShapes/Circle.cs
Normal file
67
OpenRA.Mods.Common/HitShapes/Circle.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public class CircleShape : IHitShape
|
||||
{
|
||||
public WDist OuterRadius => Radius;
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly WDist Radius = new(426);
|
||||
|
||||
[Desc("Defines the top offset relative to the actor's center.")]
|
||||
public readonly int VerticalTopOffset = 0;
|
||||
|
||||
[Desc("Defines the bottom offset relative to the actor's center.")]
|
||||
public readonly int VerticalBottomOffset = 0;
|
||||
|
||||
public CircleShape() { }
|
||||
|
||||
public CircleShape(WDist radius) { Radius = radius; }
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (VerticalTopOffset < VerticalBottomOffset)
|
||||
throw new YamlException("VerticalTopOffset must be equal to or higher than VerticalBottomOffset.");
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
return new WDist(Math.Max(0, v.Length - Radius.Length));
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation)
|
||||
{
|
||||
if (pos.Z > origin.Z + VerticalTopOffset)
|
||||
return DistanceFromEdge(pos - (origin + new WVec(0, 0, VerticalTopOffset)));
|
||||
|
||||
if (pos.Z < origin.Z + VerticalBottomOffset)
|
||||
return DistanceFromEdge(pos - (origin + new WVec(0, 0, VerticalBottomOffset)));
|
||||
|
||||
return DistanceFromEdge(pos - new WPos(origin.X, origin.Y, pos.Z));
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IHitShape.RenderDebugOverlay(HitShape hs, WorldRenderer wr, WPos origin, WRot orientation)
|
||||
{
|
||||
var shapeColor = hs.IsTraitDisabled ? Color.LightGray : Color.Yellow;
|
||||
yield return new CircleAnnotationRenderable(origin + new WVec(0, 0, VerticalTopOffset), Radius, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(origin + new WVec(0, 0, VerticalBottomOffset), Radius, 1, shapeColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
OpenRA.Mods.Common/HitShapes/IHitShape.cs
Normal file
28
OpenRA.Mods.Common/HitShapes/IHitShape.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public interface IHitShape
|
||||
{
|
||||
WDist OuterRadius { get; }
|
||||
|
||||
WDist DistanceFromEdge(in WVec v);
|
||||
WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation);
|
||||
|
||||
void Initialize();
|
||||
IEnumerable<IRenderable> RenderDebugOverlay(HitShape hs, WorldRenderer wr, WPos origin, WRot orientation);
|
||||
}
|
||||
}
|
||||
130
OpenRA.Mods.Common/HitShapes/Polygon.cs
Normal file
130
OpenRA.Mods.Common/HitShapes/Polygon.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public class PolygonShape : IHitShape
|
||||
{
|
||||
public WDist OuterRadius { get; private set; }
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly ImmutableArray<int2> Points;
|
||||
|
||||
[Desc("Defines the top offset relative to the actor's center.")]
|
||||
public readonly int VerticalTopOffset = 0;
|
||||
|
||||
[Desc("Defines the bottom offset relative to the actor's center.")]
|
||||
public readonly int VerticalBottomOffset = 0;
|
||||
|
||||
[Desc("Rotates shape by an angle relative to actor facing. Mostly required for buildings on isometric terrain.",
|
||||
"Mobile actors do NOT need this!")]
|
||||
public readonly WAngle LocalYaw = WAngle.Zero;
|
||||
|
||||
WVec[] combatOverlayVertsTop;
|
||||
WVec[] combatOverlayVertsBottom;
|
||||
int[] squares;
|
||||
|
||||
public PolygonShape() { }
|
||||
|
||||
public PolygonShape(ImmutableArray<int2> points) { Points = points; }
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (VerticalTopOffset < VerticalBottomOffset)
|
||||
throw new YamlException("VerticalTopOffset must be equal to or higher than VerticalBottomOffset.");
|
||||
|
||||
OuterRadius = new WDist(Points.Max(x => x.Length));
|
||||
combatOverlayVertsTop = Points.Select(p => new WVec(p.X, p.Y, VerticalTopOffset)).ToArray();
|
||||
combatOverlayVertsBottom = Points.Select(p => new WVec(p.X, p.Y, VerticalBottomOffset)).ToArray();
|
||||
squares = new int[Points.Length];
|
||||
squares[0] = (Points[0] - Points[^1]).LengthSquared;
|
||||
for (var i = 1; i < Points.Length; i++)
|
||||
squares[i] = (Points[i] - Points[i - 1]).LengthSquared;
|
||||
}
|
||||
|
||||
static int DistanceSquaredFromLineSegment(int2 c, int2 a, int2 b, int ab2)
|
||||
{
|
||||
var ac = c - a;
|
||||
var ac2 = ac.LengthSquared;
|
||||
var bc2 = (c - b).LengthSquared;
|
||||
|
||||
// c is closest to point a
|
||||
if (ac2 + ab2 <= bc2)
|
||||
return ac2;
|
||||
|
||||
// c is closest to point b
|
||||
if (bc2 + ab2 <= ac2)
|
||||
return bc2;
|
||||
|
||||
// c is closest to its unknown orthogonal projection (p) onto the line spanned by b with a as the origin
|
||||
// Cast to a long for the calculations to avoid overflows
|
||||
var ab = b - a;
|
||||
var ap2 = ac.X * ab.X + ac.Y * ab.Y;
|
||||
var ap = new int2((int)((long)ab.X * ap2 / ab2), (int)((long)ab.Y * ap2 / ab2));
|
||||
|
||||
// Length of vector pc squared.
|
||||
return (ac - ap).LengthSquared;
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var p = new int2(v.X, v.Y);
|
||||
var z = Math.Abs(v.Z);
|
||||
if (Points.PolygonContains(p))
|
||||
return new WDist(z);
|
||||
|
||||
var min2 = DistanceSquaredFromLineSegment(p, Points[^1], Points[0], squares[0]);
|
||||
for (var i = 1; i < Points.Length; i++)
|
||||
{
|
||||
var d2 = DistanceSquaredFromLineSegment(p, Points[i - 1], Points[i], squares[i]);
|
||||
if (d2 < min2)
|
||||
min2 = d2;
|
||||
}
|
||||
|
||||
return new WDist(Exts.ISqrt(min2 + z * z));
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation)
|
||||
{
|
||||
orientation += WRot.FromYaw(LocalYaw);
|
||||
|
||||
if (pos.Z > origin.Z + VerticalTopOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalTopOffset))).Rotate(-orientation));
|
||||
|
||||
if (pos.Z < origin.Z + VerticalBottomOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalBottomOffset))).Rotate(-orientation));
|
||||
|
||||
return DistanceFromEdge((pos - new WPos(origin.X, origin.Y, pos.Z)).Rotate(-orientation));
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IHitShape.RenderDebugOverlay(HitShape hs, WorldRenderer wr, WPos actorPos, WRot orientation)
|
||||
{
|
||||
orientation += WRot.FromYaw(LocalYaw);
|
||||
var vertsTop = combatOverlayVertsTop.Select(v => actorPos + v.Rotate(orientation)).ToArray();
|
||||
var vertsBottom = combatOverlayVertsBottom.Select(v => actorPos + v.Rotate(orientation)).ToArray();
|
||||
|
||||
var shapeColor = hs.IsTraitDisabled ? Color.LightGray : Color.Yellow;
|
||||
|
||||
yield return new PolygonAnnotationRenderable(vertsTop, actorPos, 1, shapeColor);
|
||||
yield return new PolygonAnnotationRenderable(vertsBottom, actorPos, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(actorPos, OuterRadius, 1, hs.IsTraitDisabled ? Color.Gray : Color.LimeGreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
147
OpenRA.Mods.Common/HitShapes/Rectangle.cs
Normal file
147
OpenRA.Mods.Common/HitShapes/Rectangle.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public class RectangleShape : IHitShape
|
||||
{
|
||||
public WDist OuterRadius { get; private set; }
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly int2 TopLeft;
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly int2 BottomRight;
|
||||
|
||||
[Desc("Defines the top offset relative to the actor's center.")]
|
||||
public readonly int VerticalTopOffset = 0;
|
||||
|
||||
[Desc("Defines the bottom offset relative to the actor's center.")]
|
||||
public readonly int VerticalBottomOffset = 0;
|
||||
|
||||
[Desc("Rotates shape by an angle relative to actor facing. Mostly required for buildings on isometric terrain.",
|
||||
"Mobile actors do NOT need this!")]
|
||||
public readonly WAngle LocalYaw = WAngle.Zero;
|
||||
|
||||
int2 quadrantSize;
|
||||
int2 center;
|
||||
|
||||
WVec[] combatOverlayVertsTop;
|
||||
WVec[] combatOverlayVertsBottom;
|
||||
WVec[] combatOverlayVertsSide1;
|
||||
WVec[] combatOverlayVertsSide2;
|
||||
|
||||
public RectangleShape() { }
|
||||
|
||||
public RectangleShape(int2 tl, int2 br)
|
||||
{
|
||||
TopLeft = tl;
|
||||
BottomRight = br;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (TopLeft.X >= BottomRight.X || TopLeft.Y >= BottomRight.Y)
|
||||
throw new YamlException("TopLeft and BottomRight points are invalid.");
|
||||
|
||||
if (VerticalTopOffset < VerticalBottomOffset)
|
||||
throw new YamlException("VerticalTopOffset must be equal to or higher than VerticalBottomOffset.");
|
||||
|
||||
quadrantSize = (BottomRight - TopLeft) / 2;
|
||||
center = TopLeft + quadrantSize;
|
||||
|
||||
var topRight = new int2(BottomRight.X, TopLeft.Y);
|
||||
var bottomLeft = new int2(TopLeft.X, BottomRight.Y);
|
||||
var corners = new[] { TopLeft, BottomRight, topRight, bottomLeft };
|
||||
OuterRadius = new WDist(corners.Max(x => x.Length));
|
||||
|
||||
combatOverlayVertsTop =
|
||||
[
|
||||
new(TopLeft.X, TopLeft.Y, VerticalTopOffset),
|
||||
new(BottomRight.X, TopLeft.Y, VerticalTopOffset),
|
||||
new(BottomRight.X, BottomRight.Y, VerticalTopOffset),
|
||||
new(TopLeft.X, BottomRight.Y, VerticalTopOffset),
|
||||
];
|
||||
|
||||
combatOverlayVertsBottom =
|
||||
[
|
||||
new(TopLeft.X, TopLeft.Y, VerticalBottomOffset),
|
||||
new(BottomRight.X, TopLeft.Y, VerticalBottomOffset),
|
||||
new(BottomRight.X, BottomRight.Y, VerticalBottomOffset),
|
||||
new(TopLeft.X, BottomRight.Y, VerticalBottomOffset),
|
||||
];
|
||||
|
||||
combatOverlayVertsSide1 =
|
||||
[
|
||||
new(TopLeft.X, TopLeft.Y, VerticalBottomOffset),
|
||||
new(TopLeft.X, TopLeft.Y, VerticalTopOffset),
|
||||
new(TopLeft.X, BottomRight.Y, VerticalTopOffset),
|
||||
new(TopLeft.X, BottomRight.Y, VerticalBottomOffset),
|
||||
];
|
||||
|
||||
combatOverlayVertsSide2 =
|
||||
[
|
||||
new(BottomRight.X, TopLeft.Y, VerticalBottomOffset),
|
||||
new(BottomRight.X, TopLeft.Y, VerticalTopOffset),
|
||||
new(BottomRight.X, BottomRight.Y, VerticalTopOffset),
|
||||
new(BottomRight.X, BottomRight.Y, VerticalBottomOffset),
|
||||
];
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var r = new WVec(
|
||||
Math.Max(Math.Abs(v.X - center.X) - quadrantSize.X, 0),
|
||||
Math.Max(Math.Abs(v.Y - center.Y) - quadrantSize.Y, 0), 0);
|
||||
|
||||
return new WDist(r.HorizontalLength);
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation)
|
||||
{
|
||||
orientation += WRot.FromYaw(LocalYaw);
|
||||
|
||||
if (pos.Z > origin.Z + VerticalTopOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalTopOffset))).Rotate(-orientation));
|
||||
|
||||
if (pos.Z < origin.Z + VerticalBottomOffset)
|
||||
return DistanceFromEdge((pos - (origin + new WVec(0, 0, VerticalBottomOffset))).Rotate(-orientation));
|
||||
|
||||
return DistanceFromEdge((pos - new WPos(origin.X, origin.Y, pos.Z)).Rotate(-orientation));
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IHitShape.RenderDebugOverlay(HitShape hs, WorldRenderer wr, WPos origin, WRot orientation)
|
||||
{
|
||||
orientation += WRot.FromYaw(LocalYaw);
|
||||
|
||||
var vertsTop = combatOverlayVertsTop.Select(v => origin + v.Rotate(orientation)).ToArray();
|
||||
var vertsBottom = combatOverlayVertsBottom.Select(v => origin + v.Rotate(orientation)).ToArray();
|
||||
var side1 = combatOverlayVertsSide1.Select(v => origin + v.Rotate(orientation)).ToArray();
|
||||
var side2 = combatOverlayVertsSide2.Select(v => origin + v.Rotate(orientation)).ToArray();
|
||||
|
||||
var shapeColor = hs.IsTraitDisabled ? Color.LightGray : Color.Yellow;
|
||||
|
||||
yield return new PolygonAnnotationRenderable(vertsTop, origin, 1, shapeColor);
|
||||
yield return new PolygonAnnotationRenderable(vertsBottom, origin, 1, shapeColor);
|
||||
yield return new PolygonAnnotationRenderable(side1, origin, 1, shapeColor);
|
||||
yield return new PolygonAnnotationRenderable(side2, origin, 1, shapeColor);
|
||||
yield return new CircleAnnotationRenderable(origin, OuterRadius, 1, hs.IsTraitDisabled ? Color.Gray : Color.LimeGreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user