// Copyright (c) Craftwork Games. All rights reserved.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
using System;
using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Animations;
///
/// Defines the interface for an animation controller with features to play, pause, stop, reset, and set the state of
/// animation playback such as looping, reversing, and ping-pong effects.
///
public interface IAnimationController : IDisposable
{
///
/// Gets a value indicating whether this animation controller has been disposed of.
///
bool IsDisposed { get; }
///
/// Gets a value indicating whether the animation is paused.
///
bool IsPaused { get; }
///
/// Gets a value indicating whether the animation is currently animating.
///
bool IsAnimating { get; }
///
/// Gets or sets a value indicating whether the animation should loop.
///
bool IsLooping { get; set; }
///
/// Gets or sets a value indicating whether the animation is reversed.
///
bool IsReversed { get; set; }
///
/// Gets or sets a value indicating whether the animation should ping-pong (reverse direction at the ends).
///
bool IsPingPong { get; set; }
///
/// Gets or sets the speed of the animation.
///
/// The speed cannot be less than zero.
double Speed { get; set; }
///
/// Gets or sets the action to perform when an animation event is triggered.
///
event Action OnAnimationEvent;
///
/// Gets the time remaining for the current frame.
///
TimeSpan CurrentFrameTimeRemaining { get; }
///
/// Gets the index of the current frame of the animation.
///
int CurrentFrame { get; }
///
/// Gets the total number of frames in the animation.
///
int FrameCount { get; }
///
/// Sets the animation to a specified frame.
///
/// The index of the frame to set.
///
/// Thrown when the parameter is less than zero or greater than or equal to the total
/// number of frames.
///
void SetFrame(int index);
///
/// Plays the animation from the beginning.
///
///
/// if the animation was successfully started; otherwise, .
///
bool Play();
///
/// Plays the animation from a specified starting frame.
///
/// The frame to start the animation from.
///
/// if the animation was successfully started; otherwise, .
///
///
/// Thrown when the parameter is less than zero or greater than or equal to the
/// total number of frames.
///
bool Play(int startingFrame);
///
/// Pauses the animation.
///
///
/// if the animation was successfully paused; otherwise, .
///
bool Pause();
///
/// Pauses the animation.
///
/// If set to , resets the frame duration.
///
/// if the animation was successfully paused; otherwise, .
///
bool Pause(bool resetFrameDuration);
///
/// Unpauses the animation.
///
///
/// if the animation was successfully unpaused; otherwise, .
///
bool Unpause();
///
/// Unpauses the animation.
///
/// If set to , advances to the next frame.
///
/// if the animation was successfully unpaused; otherwise, .
///
bool Unpause(bool advanceToNextFrame);
///
/// Updates the animation.
///
/// A snapshot of the timing values for the current update cycle.
void Update(GameTime gameTime);
///
/// Stops the animation.
///
///
/// if the animation was successfully stopped; otherwise, .
///
bool Stop();
///
/// Resets the animation to its initial state.
///
void Reset();
}