Fixed sequence crash
This commit is contained in:
committed by
Chris Forbes
parent
532afc3ff8
commit
b62ee4d37c
12
OpenRA.Game/Traits/Render/RenderSimple.cs
Normal file → Executable file
12
OpenRA.Game/Traits/Render/RenderSimple.cs
Normal file → Executable file
@@ -62,16 +62,20 @@ namespace OpenRA.Traits
|
||||
a.Animation.Tick();
|
||||
}
|
||||
|
||||
protected virtual string GetPrefix(Actor self)
|
||||
protected virtual string NormalizeSequence(Actor self, string baseSequence)
|
||||
{
|
||||
return self.GetDamageState() >= DamageState.Heavy ? "damaged-" : "";
|
||||
string damageState = self.GetDamageState() >= DamageState.Heavy ? "damaged-" : "";
|
||||
if (anim.HasSequence(damageState + baseSequence))
|
||||
return damageState + baseSequence;
|
||||
else
|
||||
return baseSequence;
|
||||
}
|
||||
|
||||
public void PlayCustomAnim(Actor self, string name)
|
||||
{
|
||||
if (anim.HasSequence(name))
|
||||
anim.PlayThen(GetPrefix(self) + name,
|
||||
() => anim.PlayRepeating(GetPrefix(self) + "idle"));
|
||||
anim.PlayThen(NormalizeSequence(self, name),
|
||||
() => anim.PlayRepeating(NormalizeSequence(self, "idle")));
|
||||
}
|
||||
|
||||
public class AnimationWithOffset
|
||||
|
||||
Reference in New Issue
Block a user