split render building/overlay and play sound for charge

to add the Tiberian Sun Nod Obelisk

tick slightly faster

tweak the local offsets
This commit is contained in:
Matthias Mailänder
2015-05-01 10:29:00 +02:00
parent cdc98013f7
commit d99ae3bcb9
9 changed files with 93 additions and 18 deletions

View File

@@ -8,21 +8,20 @@
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used for tesla coil and obelisk.")]
public class RenderBuildingChargeInfo : RenderBuildingInfo
{
[Desc("Sound to play when building charges.")]
public readonly string ChargeAudio = null;
[Desc("Sequence to use for building charge animation.")]
public readonly string ChargeSequence = "active";
public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); }
}
public class RenderBuildingCharge : RenderBuilding
public class RenderBuildingCharge : RenderBuilding, INotifyCharging
{
RenderBuildingChargeInfo info;
@@ -32,9 +31,8 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
public void PlayCharge(Actor self)
public void Charging(Actor self, Target target)
{
Sound.Play(info.ChargeAudio, self.CenterPosition);
PlayCustomAnim(self, info.ChargeSequence);
}
}