Rename methods/activities with Visual in them

While they may be only 'visual' in terms of influence/cell grid,
they all do update CenterPosition, which is essentially the
actual world position of the actor.
'Visual' would imply that it only affects the position where the
actor is drawn, which is inaccurate.
Furthermore, using the term 'Visual' here would make
naming future methods/properties related to visual interpolation
unnecessarily complicated, because that's where we might
need a real 'Visual(Only)Position'.
This commit is contained in:
reaperrr
2021-03-06 13:40:18 +01:00
committed by Matthias Mailänder
parent 7073279ab8
commit 2473b8763b
18 changed files with 80 additions and 80 deletions

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
? WPos.Lerp(start, end, ticks, length - 1)
: end;
positionable.SetVisualPosition(self, pos);
positionable.SetCenterPosition(self, pos);
if (++ticks >= length)
return true;

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Activities
{
public class VisualMoveIntoTarget : Activity
public class LocalMoveIntoTarget : Activity
{
readonly Mobile mobile;
readonly Target target;
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Activities
readonly WDist targetMovementThreshold;
WPos targetStartPos;
public VisualMoveIntoTarget(Actor self, in Target target, WDist targetMovementThreshold, Color? targetLineColor = null)
public LocalMoveIntoTarget(Actor self, in Target target, WDist targetMovementThreshold, Color? targetLineColor = null)
{
mobile = self.Trait<Mobile>();
this.target = target;
@@ -66,12 +66,12 @@ namespace OpenRA.Mods.Common.Activities
var speed = mobile.MovementSpeedForCell(self, self.Location);
if (delta.LengthSquared <= speed * speed)
{
mobile.SetVisualPosition(self, targetPos);
mobile.SetCenterPosition(self, targetPos);
return true;
}
// Move towards the target
mobile.SetVisualPosition(self, currentPos + delta * speed / delta.Length);
mobile.SetCenterPosition(self, currentPos + delta * speed / delta.Length);
return false;
}

View File

@@ -478,10 +478,10 @@ namespace OpenRA.Mods.Common.Activities
if (self.Location.Layer == 0)
pos -= new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(pos));
mobile.SetVisualPosition(self, pos);
mobile.SetCenterPosition(self, pos);
}
else
mobile.SetVisualPosition(self, To);
mobile.SetCenterPosition(self, To);
if (moveFraction >= MoveFractionTotal)
mobile.Facing = ToFacing;