Table of Contents

Class SpriteAnimationCombo

The Combo animation. This animation can have multiple cycles and they can be executed sequentially. Awesome for waiting for input from the player.

Namespace : SpriteAnimations

Fields

_cycles

The animation cycles

[SerializeField]
protected List<Cycle> _cycles

Field Value

List<Cycle>

_waitingTime

The waiting time between cycles before the animation is interrupted

[SerializeField]
protected float _waitingTime

Field Value

float

Properties

AnimationType

public override AnimationType AnimationType { get; }

Property Value

AnimationType

Cycles

public List<Cycle> Cycles { get; set; }

Property Value

List<Cycle>

FirstCycle

public Cycle FirstCycle { get; }

Property Value

Cycle

PerformerType

public override Type PerformerType { get; }

Property Value

Type

WaitingTime

The waiting time between cycles before the animation is interrupted

public float WaitingTime { get; set; }

Property Value

float

Methods

CalculateFramesCount()

Calculates the total amount of frames in the animation. Depending on the type of animation this can have serious perfomance impacts as it has to evaluate all frames of all the animation cycles.

public override int CalculateFramesCount()

Returns

int

The count of frames.

CreateCycle()

Creates a new cycle and adds it to the collection.

public Cycle CreateCycle()

Returns

Cycle

The created cycle.

GetCycle(int)

Get the cycle at the specified index.

public Cycle GetCycle(int index)

Parameters

index int

The index of the cycle to retrieve.

Returns

Cycle

The cycle at the specified index, or null if the index is out of range.

OnDemand(int, List<List<Sprite>>, float)

Creates a sprite animation combo on demand.

public static SpriteAnimationCombo OnDemand(int fps, List<List<Sprite>> cycles, float waitingTime = 1.25)

Parameters

fps int

The frames per second of the animation.

cycles List<List<Sprite>>

The list of cycles, each containing a list of sprites.

waitingTime float

The waiting time between cycles.

Returns

SpriteAnimationCombo

The created sprite animation combo.

RemoveCycle(Cycle)

Removes a cycle from the list of cycles.

public void RemoveCycle(Cycle cycle)

Parameters

cycle Cycle

The cycle to remove.

RemoveCycle(int)

Remove a cycle from the list of cycles.

public void RemoveCycle(int index)

Parameters

index int

The index of the cycle to be removed.

TryGetCycle(int, out Cycle)

Tries to get a cycle from the list of cycles at the specified index.

public bool TryGetCycle(int index, out Cycle cycle)

Parameters

index int

The index of the cycle to retrieve.

cycle Cycle

The retrieved cycle.

Returns

bool

True if the cycle was retrieved successfully, false otherwise.

UseAsTemplate(List<List<Sprite>>)

Creates a new SpriteAnimationCombo using the provided cycles as a template.

public SpriteAnimationCombo UseAsTemplate(List<List<Sprite>> cycles)

Parameters

cycles List<List<Sprite>>

The list of cycles to use as a template.

Returns

SpriteAnimationCombo

A new SpriteAnimationCombo instance.