From 75d6c359f1424734da54963d008fc97474ca9b72 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@993157c7-ee19-0410-b2c4-bb4e9862e678> Date: Tue, 17 Jul 2007 12:07:08 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1293 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.Game/Animation.cs | 53 ++++++++++++++++++++++++++++++++++ OpenRa.Game/OpenRa.Game.csproj | 1 + 2 files changed, 54 insertions(+) create mode 100644 OpenRa.Game/Animation.cs 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 @@ +