Fixed sequence crash

This commit is contained in:
Caleb Anderson
2010-09-19 02:09:10 -05:00
committed by Chris Forbes
parent 532afc3ff8
commit b62ee4d37c
6 changed files with 34 additions and 34 deletions

12
OpenRA.Game/Traits/Render/RenderSimple.cs Normal file → Executable file
View 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