From a2398d2e00ff5c284ddcedaf9c3be3f67757f8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 24 Jan 2016 17:14:58 +0100 Subject: [PATCH] annotate spy satellite related palettes and sprites --- OpenRA.Mods.RA/Effects/GpsSatellite.cs | 11 +++++++---- OpenRA.Mods.RA/Effects/SatelliteLaunch.cs | 13 ++++++++----- OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs | 12 +++++++++++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/OpenRA.Mods.RA/Effects/GpsSatellite.cs b/OpenRA.Mods.RA/Effects/GpsSatellite.cs index 2d61be7979..40493cdb63 100644 --- a/OpenRA.Mods.RA/Effects/GpsSatellite.cs +++ b/OpenRA.Mods.RA/Effects/GpsSatellite.cs @@ -11,20 +11,23 @@ using System.Collections.Generic; using OpenRA.Effects; using OpenRA.Graphics; +using OpenRA.Mods.RA.Traits; namespace OpenRA.Mods.RA.Effects { class GpsSatellite : IEffect { + readonly GpsPowerInfo info; readonly Animation anim; WPos pos; - public GpsSatellite(World world, WPos pos) + public GpsSatellite(World world, WPos pos, GpsPowerInfo info) { + this.info = info; this.pos = pos; - anim = new Animation(world, "sputnik"); - anim.PlayRepeating("idle"); + anim = new Animation(world, info.SatelliteImage); + anim.PlayRepeating(info.SatelliteSequence); } public void Tick(World world) @@ -38,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render(WorldRenderer wr) { - return anim.Render(pos, wr.Palette("effect")); + return anim.Render(pos, wr.Palette(info.SatellitePalette)); } } } diff --git a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs index 47fa08c92d..f908a8345c 100644 --- a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs +++ b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs @@ -11,20 +11,23 @@ using System.Collections.Generic; using OpenRA.Effects; using OpenRA.Graphics; +using OpenRA.Mods.RA.Traits; namespace OpenRA.Mods.RA.Effects { class SatelliteLaunch : IEffect { + readonly GpsPowerInfo info; readonly Animation doors; readonly WPos pos; 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))); pos = a.CenterPosition; @@ -35,12 +38,12 @@ namespace OpenRA.Mods.RA.Effects doors.Tick(); if (++frame == 19) - world.AddFrameEndTask(w => w.Add(new GpsSatellite(world, pos))); + world.AddFrameEndTask(w => w.Add(new GpsSatellite(world, pos, info))); } public IEnumerable Render(WorldRenderer wr) { - return doors.Render(pos, wr.Palette("effect")); + return doors.Render(pos, wr.Palette(info.DoorPalette)); } } } diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs index 37bc896d3f..51060d28c0 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs @@ -22,16 +22,26 @@ namespace OpenRA.Mods.RA.Traits { 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); } } class GpsPower : SupportPower, INotifyKilled, INotifyStanceChanged, INotifySold, INotifyOwnerChanged { GpsWatcher owner; + readonly GpsPowerInfo info; public GpsPower(Actor self, GpsPowerInfo info) : base(self, info) { + this.info = info; owner = self.Owner.PlayerActor.Trait(); owner.GpsAdd(self); } @@ -49,7 +59,7 @@ namespace OpenRA.Mods.RA.Traits { Game.Sound.PlayToPlayer(self.Owner, Info.LaunchSound); - w.Add(new SatelliteLaunch(self)); + w.Add(new SatelliteLaunch(self, info)); owner.Launch(self, Info); });