8public class Animator : IDisposable
15 public event Action<AnimatorEventArgs>
Started;
20 public event Action<AnimatorEventArgs>
Stopped;
25 public event Action<AnimatorEventArgs>
Cycled;
29 #region private/internal fields
31 private readonly
Tile parent;
32 private bool cycling =
false;
33 private long LastTick = EngineSimulationClock.GetCurrentTick();
35 #endregion private/internal fields
37 #region constructors / finalizer
43 protected internal Animator(
Tile tile)
56 #endregion constructors / finalizer
65 get {
return parent; }
79 get {
return cycling; }
94 #region public methods
156 else if (
CurrentCycle?.NextCycle.HideTileOnCycleEnd ==
true)
157 parent.Visible =
false;
161 internal void CycleAnimation(
long currentTick)
176 while (currentTick >= LastTick + throttle)
179 LastTick += throttle;
182 if (parent.PauseAnimation)
189 Cycled?.Invoke(
new AnimatorEventArgs(parent,
this));
208 #endregion public methods
210 #region IDisposable Members
221 GC.SuppressFinalize(
this);
224 #endregion IDisposable Members
Provides data for animator-related events, containing references to the tile and animator involved in...
Manages animation playback for a Tile, controlling animation cycles, frame timing,...
Action< AnimatorEventArgs > Started
Occurs when an animation starts playing.
Cycle SetCurrentCycle(string cycleKey)
Sets the current animation cycle using the specified cycle key.
Cycle CurrentCycle
Gets or sets the current animation cycle being played.
Action< AnimatorEventArgs > Stopped
Occurs when an animation stops playing.
bool IsCycling
Gets or sets a value indicating whether the animation is currently cycling. Setting this property to ...
void StartAnimation()
Starts playing the current animation cycle. If no cycle is set, this method has no effect....
Tile Parent
Gets the tile that owns this animator.
void StopAnimation()
Stops the current animation cycle. Raises the Stopped event and advances to the next cycle if one is ...
void Dispose()
Releases all event handlers and suppresses finalization. *** DO NOT CALL DIRECTLY!...
Action< AnimatorEventArgs > Cycled
Occurs each time the animation advances to the next frame in the cycle.
void StartAnimation(string cycleKey)
Sets the current animation cycle and starts playing it.
References a FrameSequence object, along with a particular Throttle value for animating through Frame...
static Cycle GetAnimationCycle(string cycleKey)
Retrieves a clone of the animation cycle with the specified key.
FrameSequence Sequence
The frame sequence used by this animation cycle.
Represents an abstract base class for drawable tiles in the Gondwana engine. Provides core functional...
static List< Tile > TilesAnimating
Gets the collection of all tiles that are currently animating in the scene.
bool CycleFinished
Gets a value indicating whether the animation cycle has finished playing through the sequence.