Animation

Namespace: Murder.Core.Graphics
Assembly: Murder.dll

public sealed struct Animation

⭐ Constructors

public Animation()
public Animation(ImmutableArray<T> frames, ImmutableArray<T> framesDuration, ImmutableDictionary<TKey, TValue> events, float animationDuration, T? sequence)

Parameters
frames ImmutableArray<T>
framesDuration ImmutableArray<T>
events ImmutableDictionary<TKey, TValue>
animationDuration float
sequence T?

public Animation(Int32[] frames, Single[] framesDuration, Dictionary<TKey, TValue> events, T? sequence)

Parameters
frames int[]
framesDuration float[]
events Dictionary<TKey, TValue>
sequence T?

⭐ Properties

AnimationDuration

public readonly float AnimationDuration;

The total duration of the animation, in seconds

Returns
float

Empty

public static Animation Empty;

Returns
Animation

Events

public readonly ImmutableDictionary<TKey, TValue> Events;

A dictionary associating integer indices with event strings

Returns
ImmutableDictionary<TKey, TValue>

FrameCount

public int FrameCount { get; }

A property representing the number of frames in the animation

Returns
int

Frames

public readonly ImmutableArray<T> Frames;

An array of integers representing the indices of the frames in the animation

Returns
ImmutableArray<T>

FramesDuration

public readonly ImmutableArray<T> FramesDuration;

An array of floats representing the duration of each frame in the animation, in milliseconds

Returns
ImmutableArray<T>

NextAnimation

public readonly T? NextAnimation;

Returns
T?

⭐ Methods

WithMessageAt(int, string)

public Animation WithMessageAt(int frame, string message)

Used by the editor when applying custom messages to an animation.

Parameters
frame int
message string

Returns
Animation

WithoutMessageAt(int)

public Animation WithoutMessageAt(int frame)

Used by the editor when applying custom messages to an animation.

Parameters
frame int

Returns
Animation

Evaluate(float, bool)

public FrameInfo Evaluate(float time, bool animationLoop)

Evaluates the current frame of the animation, given a time value (in seconds) and an optional maximum animation duration (in seconds)

Parameters
time float
animationLoop bool

Returns
FrameInfo

Evaluate(Single&, bool, float)

public FrameInfo Evaluate(Single& time, bool animationLoop, float forceAnimationDuration)

Parameters
time float&
animationLoop bool
forceAnimationDuration float

Returns
FrameInfo