PlayFacing() ext

This commit is contained in:
Chris Forbes
2009-12-06 20:14:50 +13:00
parent 6594a169d8
commit 5b970c499b
5 changed files with 14 additions and 13 deletions

View File

@@ -42,6 +42,13 @@ namespace OpenRa.Game.Traits
return highest * 8;
}
public static void PlayFacing(this Animation anim, string sequenceName, Func<int> facing)
{
anim.PlayFetchIndex(sequenceName,
() => Traits.Util.QuantizeFacing(facing(),
anim.CurrentSequence.Length));
}
public static int GetNearestFacing( int facing, int desiredFacing )
{
var turn = desiredFacing - facing;