SpriteEffect facing -> WAngle.

This commit is contained in:
Paul Chote
2020-05-08 20:12:32 +01:00
committed by atlimit8
parent fe58ed1283
commit 552bceb07c
5 changed files with 25 additions and 19 deletions

View File

@@ -212,8 +212,8 @@ namespace OpenRA.Mods.Common.Projectiles
if (!string.IsNullOrEmpty(info.TrailImage) && --smokeTicks < 0)
{
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().Facing)));
world.AddFrameEndTask(w => w.Add(new SpriteEffect(delayedPos, GetEffectiveFacing(), w,
info.TrailImage, info.TrailSequences.Random(world.SharedRandom), trailPalette)));
smokeTicks = info.TrailInterval;
}

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using OpenRA.GameRules;
using OpenRA.Graphics;
@@ -148,8 +149,11 @@ namespace OpenRA.Mods.Common.Projectiles
source = args.CurrentSource();
if (hasLaunchEffect && ticks == 0)
world.AddFrameEndTask(w => w.Add(new SpriteEffect(args.CurrentSource, args.CurrentMuzzleFacing, world,
{
Func<WAngle> getMuzzleFacing = () => WAngle.FromFacing(args.CurrentMuzzleFacing());
world.AddFrameEndTask(w => w.Add(new SpriteEffect(args.CurrentSource, getMuzzleFacing, world,
info.LaunchEffectImage, info.LaunchEffectSequence, info.LaunchEffectPalette)));
}
// Beam tracks target
if (info.TrackTarget && args.GuidedTarget.IsValidFor(args.SourceActor))

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
@@ -857,8 +858,8 @@ namespace OpenRA.Mods.Common.Projectiles
// Create the sprite trail effect
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.Facing)));
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos - 3 * move / 2, renderFacing, w,
info.TrailImage, info.TrailSequences.Random(world.SharedRandom), trailPalette)));
ticksToNextSmoke = info.TrailInterval;
}