diff --git a/OpenRa.Game/Animation.cs b/OpenRa.Game/Animation.cs index 512a3bcf88..a853183877 100644 --- a/OpenRa.Game/Animation.cs +++ b/OpenRa.Game/Animation.cs @@ -23,31 +23,31 @@ namespace OpenRa.Game { currentSequence = SequenceProvider.GetSequence( name, sequenceName ); frame = 0; - //tickFunc = delegate - //{ - // ++frame; - // if( frame >= currentSequence.Length ) - // { - // frame = currentSequence.Length - 1; - // tickFunc = delegate { }; - // } - //}; + 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; - //}; + tickFunc = delegate + { + frame = ( frame + 1 ) % currentSequence.Length; + }; } Action tickFunc; public void Tick( double t ) { - //tickFunc( t ); + tickFunc( t ); } } } diff --git a/OpenRa.Game/ConstructionYard.cs b/OpenRa.Game/ConstructionYard.cs index 34b6c6e862..c55fff5cb7 100644 --- a/OpenRa.Game/ConstructionYard.cs +++ b/OpenRa.Game/ConstructionYard.cs @@ -7,32 +7,23 @@ namespace OpenRa.Game { class ConstructionYard : Actor { - const string name = "fact"; - - static Sequence idle = SequenceProvider.GetSequence(name, "idle"); - static Sequence make = SequenceProvider.GetSequence(name, "make"); - - Sequence current = make; - int frame = -1; + Animation animation = new Animation( "fact" ); public ConstructionYard(float2 location, int palette) { this.renderLocation = location; this.palette = palette; + animation.PlayToEnd( "make" ); } public override Sprite[] CurrentImages { - get - { - if ((current == make) && ++frame >= current.Length) - { - frame = 0; - current = idle; - } + get { return animation.Images; } + } - return new Sprite[] { current.GetSprite(frame) }; - } + public override void Tick( World world, double t ) + { + animation.Tick( t ); } } } diff --git a/OpenRa.Game/Refinery.cs b/OpenRa.Game/Refinery.cs index faee099aae..1e38c9af28 100644 --- a/OpenRa.Game/Refinery.cs +++ b/OpenRa.Game/Refinery.cs @@ -9,18 +9,18 @@ namespace OpenRa.Game { class Refinery : Actor { - const string name = "proc"; - static Sequence idle = SequenceProvider.GetSequence(name, "idle"); + Animation a = new Animation( "proc" ); public Refinery(float2 location, int palette) { + a.PlayToEnd( "idle" ); this.renderLocation = location; this.palette = palette; } public override Sprite[] CurrentImages { - get { return new Sprite[] { idle.GetSprite(0) }; } + get { return a.Images; } } } }