annotate spy satellite related palettes and sprites

This commit is contained in:
Matthias Mailänder
2016-01-24 17:14:58 +01:00
parent 38625ec6f8
commit a2398d2e00
3 changed files with 26 additions and 10 deletions

View File

@@ -11,20 +11,23 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.RA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.RA.Effects
{ {
class GpsSatellite : IEffect class GpsSatellite : IEffect
{ {
readonly GpsPowerInfo info;
readonly Animation anim; readonly Animation anim;
WPos pos; WPos pos;
public GpsSatellite(World world, WPos pos) public GpsSatellite(World world, WPos pos, GpsPowerInfo info)
{ {
this.info = info;
this.pos = pos; this.pos = pos;
anim = new Animation(world, "sputnik"); anim = new Animation(world, info.SatelliteImage);
anim.PlayRepeating("idle"); anim.PlayRepeating(info.SatelliteSequence);
} }
public void Tick(World world) public void Tick(World world)
@@ -38,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
return anim.Render(pos, wr.Palette("effect")); return anim.Render(pos, wr.Palette(info.SatellitePalette));
} }
} }
} }

View File

@@ -11,20 +11,23 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.RA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.RA.Effects
{ {
class SatelliteLaunch : IEffect class SatelliteLaunch : IEffect
{ {
readonly GpsPowerInfo info;
readonly Animation doors; readonly Animation doors;
readonly WPos pos; readonly WPos pos;
int frame = 0; int frame = 0;
public SatelliteLaunch(Actor a) public SatelliteLaunch(Actor a, GpsPowerInfo info)
{ {
doors = new Animation(a.World, "atek"); this.info = info;
doors.PlayThen("active", doors = new Animation(a.World, info.DoorImage);
doors.PlayThen(info.DoorSequence,
() => a.World.AddFrameEndTask(w => w.Remove(this))); () => a.World.AddFrameEndTask(w => w.Remove(this)));
pos = a.CenterPosition; pos = a.CenterPosition;
@@ -35,12 +38,12 @@ namespace OpenRA.Mods.RA.Effects
doors.Tick(); doors.Tick();
if (++frame == 19) if (++frame == 19)
world.AddFrameEndTask(w => w.Add(new GpsSatellite(world, pos))); world.AddFrameEndTask(w => w.Add(new GpsSatellite(world, pos, info)));
} }
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
return doors.Render(pos, wr.Palette("effect")); return doors.Render(pos, wr.Palette(info.DoorPalette));
} }
} }
} }

View File

@@ -22,16 +22,26 @@ namespace OpenRA.Mods.RA.Traits
{ {
public readonly int RevealDelay = 0; public readonly int RevealDelay = 0;
public readonly string DoorImage = "atek";
[SequenceReference("DoorImage")] public readonly string DoorSequence = "active";
[PaletteReference] public readonly string DoorPalette = "effect";
public readonly string SatelliteImage = "sputnik";
[SequenceReference("SatelliteImage")] public readonly string SatelliteSequence = "idle";
[PaletteReference] public readonly string SatellitePalette = "effect";
public override object Create(ActorInitializer init) { return new GpsPower(init.Self, this); } public override object Create(ActorInitializer init) { return new GpsPower(init.Self, this); }
} }
class GpsPower : SupportPower, INotifyKilled, INotifyStanceChanged, INotifySold, INotifyOwnerChanged class GpsPower : SupportPower, INotifyKilled, INotifyStanceChanged, INotifySold, INotifyOwnerChanged
{ {
GpsWatcher owner; GpsWatcher owner;
readonly GpsPowerInfo info;
public GpsPower(Actor self, GpsPowerInfo info) public GpsPower(Actor self, GpsPowerInfo info)
: base(self, info) : base(self, info)
{ {
this.info = info;
owner = self.Owner.PlayerActor.Trait<GpsWatcher>(); owner = self.Owner.PlayerActor.Trait<GpsWatcher>();
owner.GpsAdd(self); owner.GpsAdd(self);
} }
@@ -49,7 +59,7 @@ namespace OpenRA.Mods.RA.Traits
{ {
Game.Sound.PlayToPlayer(self.Owner, Info.LaunchSound); Game.Sound.PlayToPlayer(self.Owner, Info.LaunchSound);
w.Add(new SatelliteLaunch(self)); w.Add(new SatelliteLaunch(self, info));
owner.Launch(self, Info); owner.Launch(self, Info);
}); });