Table of Contents

Class SpriteAnimationSingleCycle

The Single Cycle Animation. This animation has only a single cycle.

Namespace : SpriteAnimations

Fields

_cycle

The animation Cycle

[SerializeField]
protected Cycle _cycle

Field Value

Cycle

_isLoopable

If the animation should loop

[SerializeField]
protected bool _isLoopable

Field Value

bool

Properties

AnimationType

public override AnimationType AnimationType { get; }

Property Value

AnimationType

Cycle

The animation Cycle

public Cycle Cycle { get; }

Property Value

Cycle

IsLoopable

If the animation should loop

public bool IsLoopable { get; set; }

Property Value

bool

PerformerType

public override Type PerformerType { get; }

Property Value

Type

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.

GenerateCycle()

This must be executed upon the asset creation

public void GenerateCycle()

OnDemand(int, List<Sprite>, bool)

Creates a new SpriteAnimationSingleCycle on demand.

public static SpriteAnimationSingleCycle OnDemand(int fps, List<Sprite> cycle, bool isLoopable = false)

Parameters

fps int
cycle List<Sprite>
isLoopable bool

Returns

SpriteAnimationSingleCycle

SetFrameID(int, string)

Sets a frame ID overriding the possible existent one. Note that if you are doing this while using the UnityEditor and this is not an OnDemand animation, the ScriptableObject will save the ID meaning that the previous ID will be lost.

public void SetFrameID(int index, string id)

Parameters

index int
id string

UseAsTemplate(List<Sprite>)

Creates a new SpriteAnimationSingleCycle using this instance as a template.

public SpriteAnimationSingleCycle UseAsTemplate(List<Sprite> cycle)

Parameters

cycle List<Sprite>

The list of sprites to be assigned to the frames of the new animation.

Returns

SpriteAnimationSingleCycle

A new SpriteAnimationSingleCycle with the assigned sprites.