Convert IFacing.Facing and TurnSpeed to WAngle.

This commit is contained in:
Paul Chote
2020-06-01 20:42:28 +01:00
committed by teinarss
parent 01417c88c5
commit 6adf45bcb4
44 changed files with 101 additions and 120 deletions

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits.Render
{
BodyOrientation body;
IFacing facing;
int cachedFacing;
WAngle cachedFacing;
int cachedInterval;
public LeavesTrails(Actor self, LeavesTrailsInfo info)
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits.Render
{
body = self.Trait<BodyOrientation>();
facing = self.TraitOrDefault<IFacing>();
cachedFacing = facing != null ? facing.Facing : 0;
cachedFacing = facing != null ? facing.Facing : WAngle.Zero;
cachedPosition = self.CenterPosition;
base.Created(self);
@@ -125,14 +125,14 @@ namespace OpenRA.Mods.Common.Traits.Render
var pos = Info.Type == TrailType.CenterPosition ? spawnPosition + body.LocalToWorld(offsetRotation) :
self.World.Map.CenterOfCell(spawnCell);
var spawnFacing = Info.SpawnAtLastPosition ? cachedFacing : (facing != null ? facing.Facing : 0);
var spawnFacing = Info.SpawnAtLastPosition ? cachedFacing : (facing != null ? facing.Facing : WAngle.Zero);
if ((Info.TerrainTypes.Count == 0 || Info.TerrainTypes.Contains(type)) && !string.IsNullOrEmpty(Info.Image))
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, self.World, Info.Image,
Info.Sequences.Random(Game.CosmeticRandom), Info.Palette, Info.VisibleThroughFog, spawnFacing)));
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, spawnFacing, self.World, Info.Image,
Info.Sequences.Random(Game.CosmeticRandom), Info.Palette, Info.VisibleThroughFog)));
cachedPosition = self.CenterPosition;
cachedFacing = facing != null ? facing.Facing : 0;
cachedFacing = facing != null ? facing.Facing : WAngle.Zero;
ticks = 0;
cachedInterval = isMoving ? Info.MovingInterval : Info.StationaryInterval;