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
_isLoopable
If the animation should loop
[SerializeField]
protected bool _isLoopable
Field Value
Properties
AnimationType
public override AnimationType AnimationType { get; }
Property Value
Cycle
The animation Cycle
public Cycle Cycle { get; }
Property Value
IsLoopable
If the animation should loop
public bool IsLoopable { get; set; }
Property Value
PerformerType
public override Type PerformerType { get; }
Property Value
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
Returns
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
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.