Support multiple With(Turret)AimAnimation traits

This commit is contained in:
abcdefg30
2022-06-08 22:19:18 +02:00
committed by Matthias Mailänder
parent f2eb42a4b2
commit cea9ceb72e
2 changed files with 30 additions and 2 deletions

View File

@@ -59,11 +59,25 @@ namespace OpenRA.Mods.Common.Traits.Render
void INotifyAiming.StartedAiming(Actor self, AttackBase ab) void INotifyAiming.StartedAiming(Actor self, AttackBase ab)
{ {
// Ignore any notifications from INotifyAiming while this trait is disabled
// otherwise we replace the current animation without being active
if (IsTraitDisabled)
return;
// We know that at least one AttackBase is aiming // We know that at least one AttackBase is aiming
UpdateSequence(true); UpdateSequence(true);
} }
void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } void INotifyAiming.StoppedAiming(Actor self, AttackBase ab)
{
// Ignore any notifications from INotifyAiming while this trait is disabled
// otherwise we replace the current animation without being active
if (IsTraitDisabled)
return;
UpdateSequence(attackBases.Any(a => a.IsAiming));
}
protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); }
protected override void TraitDisabled(Actor self) protected override void TraitDisabled(Actor self)

View File

@@ -59,11 +59,25 @@ namespace OpenRA.Mods.Common.Traits.Render
void INotifyAiming.StartedAiming(Actor self, AttackBase ab) void INotifyAiming.StartedAiming(Actor self, AttackBase ab)
{ {
// Ignore any notifications from INotifyAiming while this trait is disabled
// otherwise we replace the current animation without being active
if (IsTraitDisabled)
return;
// We know that at least one AttackBase is aiming // We know that at least one AttackBase is aiming
UpdateSequence(true); UpdateSequence(true);
} }
void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } void INotifyAiming.StoppedAiming(Actor self, AttackBase ab)
{
// Ignore any notifications from INotifyAiming while this trait is disabled
// otherwise we replace the current animation without being active
if (IsTraitDisabled)
return;
UpdateSequence(attackBases.Any(a => a.IsAiming));
}
protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); }
protected override void TraitDisabled(Actor self) protected override void TraitDisabled(Actor self)