ScaredyCat trait for civilians.

This commit is contained in:
Paul Chote
2011-02-15 22:38:13 +13:00
parent fa86502795
commit b6328b356c
6 changed files with 76 additions and 27 deletions

View File

@@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA.Render
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage, INotifyIdle
{
public bool Panicked = false;
public enum AnimationState
{
Idle,
@@ -53,7 +54,7 @@ namespace OpenRA.Mods.RA.Render
public override void Tick(Actor self)
{
base.Tick(self);
// If path is blocked, we can have !isMoving and !idle
// Need to handle this case specially
if (!mobile.IsMoving && State == AnimationState.Moving)
@@ -64,7 +65,7 @@ namespace OpenRA.Mods.RA.Render
else if (State != AnimationState.Moving && mobile.IsMoving)
{
State = AnimationState.Moving;
anim.PlayRepeating("run");
anim.PlayRepeating(Panicked ? "panic-run" : "run");
}
}