Class CompositeAnimator
Namespace : SpriteAnimations
Fields
_compositeAnimation
The current SpriteAnimationComposite associated to the CompositeAnimator
protected SpriteAnimationComposite _compositeAnimation
Field Value
_currentCompositeCycle
The current CompositeCycle
protected CompositeCycle _currentCompositeCycle
Field Value
_onAntecipationEndAction
The action to be invoked when the antecipation cycle ends
protected UnityAction _onAntecipationEndAction
Field Value
- UnityAction
_onCoreEndAction
The action to be invoked when the core cycle ends
protected UnityAction _onCoreEndAction
Field Value
- UnityAction
_onRecoveryEndAction
The action to be invoked when the recovery cycle ends
protected UnityAction _onRecoveryEndAction
Field Value
- UnityAction
_shouldLoopCore
If the current animation should loop the core cycle
protected bool _shouldLoopCore
Field Value
Methods
ChangeCycle(CompositeCycle)
Changes the current cycle of the composite animation.
protected virtual void ChangeCycle(CompositeCycle cycle)
Parameters
cycle
CompositeCycleThe new cycle to change to.
EndAnimation()
Use this to stop playing the animation. Cannot use StopAnimation() because of events being cleared.
protected void EndAnimation()
EndCycle()
Ends the current cycle of the composite animation changing the cycles according to the flow and triggering their respective actions.
protected void EndCycle()
ExitCoreLoop()
Breaks the core cycle loop and starts the recovery cycle.
public virtual CompositeAnimator ExitCoreLoop()
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
FromStart()
Resets the current animation and plays it from start.
public CompositeAnimator FromStart()
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
ResetCycle()
Resets the cycle.
protected void ResetCycle()
SetLoopableCore(bool)
Sets whether the core cycle should loop or not.
public virtual CompositeAnimator SetLoopableCore(bool isLoopableCore)
Parameters
isLoopableCore
boolA boolean indicating whether the core cycle should loop.
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
SetOnAntecipationEnd(UnityAction)
Sets the action to be executed when the antecipation ends.
public virtual CompositeAnimator SetOnAntecipationEnd(UnityAction onAntecipationEnd)
Parameters
onAntecipationEnd
UnityActionThe action to be executed.
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
SetOnCoreEnd(UnityAction)
Sets the action to be executed when the core cycle ends.
public virtual CompositeAnimator SetOnCoreEnd(UnityAction onCoreEnd)
Parameters
onCoreEnd
UnityActionThe action to be executed.
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
SetOnRecoveryEnd(UnityAction)
Sets the action to be executed when the recovery cycle ends.
public virtual CompositeAnimator SetOnRecoveryEnd(UnityAction onRecoveryEnd)
Parameters
onRecoveryEnd
UnityActionThe action to be executed.
Returns
- CompositeAnimator
The updated CompositeAnimator instance.
StartAnimation(SpriteAnimation)
Must be called to start playing an animation
public override void StartAnimation(SpriteAnimation animation)
Parameters
animation
SpriteAnimation
StopAnimation()
Must be called every time the animation should be stopped.
public override void StopAnimation()
Tick(float)
The method called every time the animator should evaluate if the frame must be changed.
public override void Tick(float deltaTime)
Parameters
deltaTime
floatThe time elapsed since the last tick.