Animation facing -> WAngle.
This commit is contained in:
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
if (!string.IsNullOrEmpty(info.Image))
|
||||
{
|
||||
anim = new Animation(world, info.Image, new Func<int>(GetEffectiveFacing));
|
||||
anim = new Animation(world, info.Image, new Func<WAngle>(GetEffectiveFacing));
|
||||
anim.PlayRepeating(info.Sequences.Random(world.SharedRandom));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
remainingBounces = info.BounceCount;
|
||||
}
|
||||
|
||||
int GetEffectiveFacing()
|
||||
WAngle GetEffectiveFacing()
|
||||
{
|
||||
var at = (float)ticks / (length - 1);
|
||||
var attitude = angle.Tan() * (1 - 2 * at) / (4 * 1024);
|
||||
@@ -184,9 +184,11 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
var u = (facing % 128) / 128f;
|
||||
var scale = 512 * u * (1 - u);
|
||||
|
||||
return (int)(facing < 128
|
||||
var effective = (int)(facing < 128
|
||||
? facing - scale * attitude
|
||||
: facing + scale * attitude);
|
||||
|
||||
return WAngle.FromFacing(effective);
|
||||
}
|
||||
|
||||
public void Tick(World world)
|
||||
@@ -211,7 +213,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var delayedPos = WPos.LerpQuadratic(source, target, angle, ticks - info.TrailDelay, length);
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(delayedPos, w, info.TrailImage, info.TrailSequences.Random(world.SharedRandom),
|
||||
trailPalette, facing: GetEffectiveFacing())));
|
||||
trailPalette, facing: GetEffectiveFacing().Facing)));
|
||||
|
||||
smokeTicks = info.TrailInterval;
|
||||
}
|
||||
|
||||
@@ -65,13 +65,14 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
this.info = info;
|
||||
this.args = args;
|
||||
pos = args.Source;
|
||||
var facing = WAngle.FromFacing(args.Facing);
|
||||
var convertedVelocity = new WVec(info.Velocity.Y, -info.Velocity.X, info.Velocity.Z);
|
||||
velocity = convertedVelocity.Rotate(WRot.FromFacing(args.Facing));
|
||||
velocity = convertedVelocity.Rotate(WRot.FromYaw(facing));
|
||||
acceleration = new WVec(info.Acceleration.Y, -info.Acceleration.X, info.Acceleration.Z);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.Image))
|
||||
{
|
||||
anim = new Animation(args.SourceActor.World, info.Image, () => args.Facing);
|
||||
anim = new Animation(args.SourceActor.World, info.Image, () => facing);
|
||||
|
||||
if (!string.IsNullOrEmpty(info.OpenSequence))
|
||||
anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom)));
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
WDist distanceCovered;
|
||||
WDist rangeLimit;
|
||||
|
||||
int renderFacing;
|
||||
WAngle renderFacing;
|
||||
|
||||
[Sync]
|
||||
int hFacing;
|
||||
@@ -835,7 +835,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
else
|
||||
move = HomingTick(world, tarDistVec, relTarHorDist);
|
||||
|
||||
renderFacing = new WVec(move.X, move.Y - move.Z, 0).Yaw.Facing;
|
||||
renderFacing = new WVec(move.X, move.Y - move.Z, 0).Yaw;
|
||||
|
||||
// Move the missile
|
||||
var lastPos = pos;
|
||||
@@ -858,7 +858,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated))
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos - 3 * move / 2, w, info.TrailImage, info.TrailSequences.Random(world.SharedRandom),
|
||||
trailPalette, facing: renderFacing)));
|
||||
trailPalette, facing: renderFacing.Facing)));
|
||||
|
||||
ticksToNextSmoke = info.TrailInterval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user