war factory behavior is sortof sane, if glitchy
This commit is contained in:
@@ -7,6 +7,7 @@ namespace OpenRa.Game.Graphics
|
||||
readonly string name;
|
||||
Sequence currentSequence;
|
||||
int frame = 0;
|
||||
bool backwards = false;
|
||||
bool tickAlways;
|
||||
|
||||
public Animation( string name )
|
||||
@@ -15,7 +16,16 @@ namespace OpenRa.Game.Graphics
|
||||
Play( "idle" );
|
||||
}
|
||||
|
||||
public Sprite Image { get { return currentSequence.GetSprite( frame ); } }
|
||||
public Sprite Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return backwards
|
||||
? currentSequence.GetSprite(currentSequence.End - frame - 1)
|
||||
: currentSequence.GetSprite(frame);
|
||||
}
|
||||
}
|
||||
|
||||
public float2 Center { get { return 0.25f * new float2(currentSequence.GetSprite(0).bounds.Size); } }
|
||||
|
||||
public void Play( string sequenceName )
|
||||
@@ -23,6 +33,11 @@ namespace OpenRa.Game.Graphics
|
||||
PlayThen(sequenceName, () => { });
|
||||
}
|
||||
|
||||
public void PlayBackwards(string sequenceName)
|
||||
{
|
||||
PlayBackwardsThen(sequenceName, () => { });
|
||||
}
|
||||
|
||||
public void PlayRepeating( string sequenceName )
|
||||
{
|
||||
PlayThen( sequenceName, () => PlayRepeating( sequenceName ) );
|
||||
@@ -30,6 +45,7 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public void PlayThen( string sequenceName, Action after )
|
||||
{
|
||||
backwards = false;
|
||||
tickAlways = false;
|
||||
currentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
||||
frame = 0;
|
||||
@@ -45,8 +61,15 @@ namespace OpenRa.Game.Graphics
|
||||
};
|
||||
}
|
||||
|
||||
public void PlayBackwardsThen(string sequenceName, Action after)
|
||||
{
|
||||
PlayThen(sequenceName, after);
|
||||
backwards = true;
|
||||
}
|
||||
|
||||
public void PlayFetchIndex( string sequenceName, Func<int> func )
|
||||
{
|
||||
backwards = false;
|
||||
tickAlways = true;
|
||||
currentSequence = SequenceProvider.GetSequence( name, sequenceName );
|
||||
frame = func();
|
||||
|
||||
Reference in New Issue
Block a user