Make IsDisabled a method on Actor.
This allows us to cache the disabled traits, which simplifies life for some callers since we relieve them of having to cache it, as well as improving perf for all IsDisabled calls.
This commit is contained in:
@@ -54,11 +54,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, info.Sequence));
|
||||
|
||||
if (info.PauseOnLowPower)
|
||||
{
|
||||
var disabled = self.TraitsImplementing<IDisable>();
|
||||
DefaultAnimation.Paused = () => disabled.Any(d => d.Disabled)
|
||||
&& DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, info.Sequence);
|
||||
}
|
||||
DefaultAnimation.Paused = () =>
|
||||
self.IsDisabled() && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, info.Sequence);
|
||||
}
|
||||
|
||||
public void PlayCustomAnimThen(Actor self, string name, Action a)
|
||||
|
||||
Reference in New Issue
Block a user