Table of Contents

Class Cycle

Namespace : SpriteAnimations

Constructors

Cycle()

public Cycle()

Cycle(SpriteAnimation)

public Cycle(SpriteAnimation animation)

Parameters

animation SpriteAnimation

Fields

_animation

[SerializeField]
protected SpriteAnimation _animation

Field Value

SpriteAnimation

_frames

[SerializeField]
protected List<Frame> _frames

Field Value

List<Frame>

_identifiable

[SerializeField]
protected bool _identifiable

Field Value

bool

Properties

Animation

The animation wich this cycle belongs to

public SpriteAnimation Animation { get; set; }

Property Value

SpriteAnimation

Frames

public List<Frame> Frames { get; }

Property Value

List<Frame>

Identifiable

If the cycle can have identifiable frames

public bool Identifiable { get; set; }

Property Value

bool

Size

The size of the cycle (number of frames)

public int Size { get; }

Property Value

int

Methods

AddFrame(Frame)

public void AddFrame(Frame frame)

Parameters

frame Frame

AddFrame(Sprite)

public void AddFrame(Sprite sprite)

Parameters

sprite Sprite

AddFrame(Sprite, string)

public void AddFrame(Sprite sprite, string id)

Parameters

sprite Sprite
id string

CalculateDuration()

Calculate the total duration of the cycle based on the given FPS rate.

public float CalculateDuration()

Returns

float

The duration of the sequence of frames.

EvaluateFrame(float)

Evaluates the frame based on the elapsed time.

public Frame EvaluateFrame(float elapsedTime)

Parameters

elapsedTime float

The elapsed time in seconds.

Returns

Frame

The evaluated frame.

EvaluateIndexAndFrame(float)

Evaluates the frame at a given elapsed time.

public (int index, Frame frame) EvaluateIndexAndFrame(float elapsedTime)

Parameters

elapsedTime float

The elapsed time in seconds.

Returns

(int index, Frame frame)

A tuple containing the index of the frame and the evaluated frame.

GetFirstFrame()

public Frame GetFirstFrame()

Returns

Frame

TryGetFrame(int, out Frame)

public bool TryGetFrame(int index, out Frame frame)

Parameters

index int
frame Frame

Returns

bool