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
_waitingTime
The waiting time between cycles before the animation is interrupted
[SerializeField]
protected float _waitingTime
Field Value
Properties
AnimationType
public override AnimationType AnimationType { get; }
Property Value
Cycles
public List<Cycle> Cycles { get; set; }
Property Value
FirstCycle
public Cycle FirstCycle { get; }
Property Value
PerformerType
public override Type PerformerType { get; }
Property Value
WaitingTime
The waiting time between cycles before the animation is interrupted
public float WaitingTime { get; set; }
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.
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
intThe 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
intThe frames per second of the animation.
cycles
List<List<Sprite>>The list of cycles, each containing a list of sprites.
waitingTime
floatThe 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
CycleThe cycle to remove.
RemoveCycle(int)
Remove a cycle from the list of cycles.
public void RemoveCycle(int index)
Parameters
index
intThe 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
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
Returns
- SpriteAnimationCombo
A new SpriteAnimationCombo instance.