rename WRange to WDist
This commit is contained in:
2
OpenRA.Game/Traits/Health.cs
Executable file → Normal file
2
OpenRA.Game/Traits/Health.cs
Executable file → Normal file
@@ -18,7 +18,7 @@ namespace OpenRA.Traits
|
||||
public readonly int HP = 0;
|
||||
|
||||
[Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage.")]
|
||||
public readonly WRange Radius = new WRange(426);
|
||||
public readonly WDist Radius = new WDist(426);
|
||||
|
||||
[Desc("Trigger interfaces such as AnnounceOnKill?")]
|
||||
public readonly bool NotifyAppliedDamage = true;
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInRange(WPos origin, WRange range)
|
||||
public bool IsInRange(WPos origin, WDist range)
|
||||
{
|
||||
if (Type == TargetType.Invalid)
|
||||
return false;
|
||||
|
||||
@@ -234,9 +234,9 @@ namespace OpenRA.Traits
|
||||
{
|
||||
Activity MoveTo(CPos cell, int nearEnough);
|
||||
Activity MoveTo(CPos cell, Actor ignoredActor);
|
||||
Activity MoveWithinRange(Target target, WRange range);
|
||||
Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange);
|
||||
Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange);
|
||||
Activity MoveWithinRange(Target target, WDist range);
|
||||
Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange);
|
||||
Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange);
|
||||
Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any);
|
||||
Activity MoveToTarget(Actor self, Target target);
|
||||
Activity MoveIntoTarget(Actor self, Target target);
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public readonly int Id;
|
||||
public WPos Position { get; private set; }
|
||||
public WRange Range { get; private set; }
|
||||
public WDist Range { get; private set; }
|
||||
|
||||
public WPos TopLeft { get; private set; }
|
||||
public WPos BottomRight { get; private set; }
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Traits
|
||||
|
||||
IEnumerable<Actor> currentActors = Enumerable.Empty<Actor>();
|
||||
|
||||
public ProximityTrigger(int id, WPos pos, WRange range, Action<Actor> onActorEntered, Action<Actor> onActorExited)
|
||||
public ProximityTrigger(int id, WPos pos, WDist range, Action<Actor> onActorEntered, Action<Actor> onActorExited)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -112,12 +112,12 @@ namespace OpenRA.Traits
|
||||
Update(pos, range);
|
||||
}
|
||||
|
||||
public void Update(WPos newPos, WRange newRange)
|
||||
public void Update(WPos newPos, WDist newRange)
|
||||
{
|
||||
Position = newPos;
|
||||
Range = newRange;
|
||||
|
||||
var offset = new WVec(newRange, newRange, WRange.Zero);
|
||||
var offset = new WVec(newRange, newRange, WDist.Zero);
|
||||
TopLeft = newPos - offset;
|
||||
BottomRight = newPos + offset;
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace OpenRA.Traits
|
||||
return;
|
||||
|
||||
var oldActors = currentActors;
|
||||
var delta = new WVec(Range, Range, WRange.Zero);
|
||||
var delta = new WVec(Range, Range, WDist.Zero);
|
||||
currentActors = am.ActorsInBox(Position - delta, Position + delta)
|
||||
.Where(a => (a.CenterPosition - Position).HorizontalLengthSquared < Range.RangeSquared)
|
||||
.ToList();
|
||||
@@ -407,7 +407,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public int AddProximityTrigger(WPos pos, WRange range, Action<Actor> onEntry, Action<Actor> onExit)
|
||||
public int AddProximityTrigger(WPos pos, WDist range, Action<Actor> onEntry, Action<Actor> onExit)
|
||||
{
|
||||
var id = nextTriggerId++;
|
||||
var t = new ProximityTrigger(id, pos, range, onEntry, onExit);
|
||||
@@ -431,7 +431,7 @@ namespace OpenRA.Traits
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateProximityTrigger(int id, WPos newPos, WRange newRange)
|
||||
public void UpdateProximityTrigger(int id, WPos newPos, WDist newRange)
|
||||
{
|
||||
ProximityTrigger t;
|
||||
if (!proximityTriggers.TryGetValue(id, out t))
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
|
||||
Hash += 1;
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, WPos pos, WRange range)
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, WPos pos, WDist range)
|
||||
{
|
||||
var r = (range.Range + 1023) / 1024;
|
||||
var limit = range.RangeSquared;
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Traits
|
||||
yield return c;
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, CPos cell, WRange range)
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, CPos cell, WDist range)
|
||||
{
|
||||
return CellsInRange(map, map.CenterOfCell(cell), range);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user