De-duplicate some WithTurretAttackAnimation code
This commit is contained in:
@@ -55,32 +55,24 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
wst.PlayCustomAnimation(self, Info.Sequence);
|
wst.PlayCustomAnimation(self, Info.Sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
void NotifyAttack(Actor self)
|
||||||
{
|
|
||||||
if (IsTraitDisabled || a != armament)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Info.DelayRelativeTo == AttackDelayType.Attack)
|
|
||||||
{
|
{
|
||||||
if (Info.Delay > 0)
|
if (Info.Delay > 0)
|
||||||
tick = Info.Delay;
|
tick = Info.Delay;
|
||||||
else
|
else
|
||||||
PlayAttackAnimation(self);
|
PlayAttackAnimation(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
||||||
|
{
|
||||||
|
if (!IsTraitDisabled && a == armament && Info.DelayRelativeTo == AttackDelayType.Attack)
|
||||||
|
NotifyAttack(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel)
|
void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel)
|
||||||
{
|
{
|
||||||
if (IsTraitDisabled || a != armament)
|
if (!IsTraitDisabled && a == armament && Info.DelayRelativeTo == AttackDelayType.Preparation)
|
||||||
return;
|
NotifyAttack(self);
|
||||||
|
|
||||||
if (Info.DelayRelativeTo == AttackDelayType.Preparation)
|
|
||||||
{
|
|
||||||
if (Info.Delay > 0)
|
|
||||||
tick = Info.Delay;
|
|
||||||
else
|
|
||||||
PlayAttackAnimation(self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
|
|||||||
Reference in New Issue
Block a user