diff --git a/OpenRa.Game/Animation.cs b/OpenRa.Game/Animation.cs new file mode 100644 index 0000000000..512a3bcf88 --- /dev/null +++ b/OpenRa.Game/Animation.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace OpenRa.Game +{ + class Animation + { + readonly string name; + Sequence currentSequence; + int frame = 0; + + public Animation( string name ) + { + this.name = name; + PlayToEnd( "idle" ); + } + + public Sprite[] Images { get { return new Sprite[] { currentSequence.GetSprite( frame ) }; } } + + public void PlayToEnd( string sequenceName ) + { + currentSequence = SequenceProvider.GetSequence( name, sequenceName ); + frame = 0; + //tickFunc = delegate + //{ + // ++frame; + // if( frame >= currentSequence.Length ) + // { + // frame = currentSequence.Length - 1; + // tickFunc = delegate { }; + // } + //}; + } + + public void PlayRepeating( string sequenceName ) + { + currentSequence = SequenceProvider.GetSequence( name, sequenceName ); + frame = 0; + //tickFunc = delegate + //{ + // frame = ( frame + 1 ) % currentSequence.Length; + //}; + } + + Action tickFunc; + public void Tick( double t ) + { + //tickFunc( t ); + } + } +} diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 28941c5508..d4a0e8cfbf 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -41,6 +41,7 @@ +