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

@@ -29,6 +29,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay between charge attacks (in ticks).")]
public readonly int ChargeDelay = 3;
[Desc("Sound to play when actor charges.")]
public readonly string ChargeAudio = null;
public override object Create(ActorInitializer init) { return new AttackCharge(init.Self, this); }
}
@@ -98,7 +101,11 @@ namespace OpenRA.Mods.Common.Traits
if (attack.charges == 0)
return this;
self.Trait<RenderBuildingCharge>().PlayCharge(self);
foreach (var notify in self.TraitsImplementing<INotifyCharging>())
notify.Charging(self, target);
if (!string.IsNullOrEmpty(attack.info.ChargeAudio))
Sound.Play(attack.info.ChargeAudio, self.CenterPosition);
return Util.SequenceActivities(new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this);
}