Class ComboAnimator
The performer responsible for playing combo animations.
Namespace : SpriteAnimations
Fields
_comboAnimation
The current SpriteAnimationCombo associated to the ComboAnimator
protected SpriteAnimationCombo _comboAnimation
Field Value
_currentCycleIndex
The currently being played cycle's index
protected int _currentCycleIndex
Field Value
_currentCycleWaitOverride
The amount of time to wait for the next cycle. If higher than 0, it will be used instead of the WaitingTime
protected float _currentCycleWaitOverride
Field Value
_currentWaitCounter
The current counter for undertanding whe the animation should be interrupted
protected float _currentWaitCounter
Field Value
_onCycleEndedAction
The action to be invoked when the current cycle ends
protected UnityAction<int> _onCycleEndedAction
Field Value
- UnityAction<int>
_onInterruptedAction
The action to be invoked when the animation is interrupted
protected UnityAction _onInterruptedAction
Field Value
- UnityAction
_waiting
Is the combo animator currently waiting for the Next() method to be called?
protected bool _waiting
Field Value
Methods
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 animation.
protected void EndCycle()
EvaluateNewFrame(float)
Evaluates a new frame based on the given deltaTime.
protected void EvaluateNewFrame(float deltaTime)
Parameters
deltaTime
floatThe time elapsed since the last frame.
EvaluateWait(float)
Evaluates the wait time for the animation.
protected void EvaluateWait(float deltaTime)
Parameters
deltaTime
floatThe time since the last frame.
FromStart()
Resets the current animation cycle and starts playing the single cycle animation from the start.
public ComboAnimator FromStart()
Returns
- ComboAnimator
The updated SingleCycleAnimator instance.
Next()
Plays the next cycle.
public ComboAnimator Next()
Returns
- ComboAnimator
The updated ComboAnimator.
OverrideInputWait(float)
Overrides the input wait time for the combo animator.
public ComboAnimator OverrideInputWait(float maxInputWait)
Parameters
maxInputWait
floatThe maximum input wait time.
Returns
- ComboAnimator
The updated ComboAnimator.
SetOnCycleEnded(UnityAction<int>)
Sets the action to be executed when a cycle ends.
public ComboAnimator SetOnCycleEnded(UnityAction<int> onCycleEnded)
Parameters
onCycleEnded
UnityAction<int>The action to be executed.
Returns
- ComboAnimator
The updated ComboAnimator.
SetOnInterrupted(UnityAction)
Sets the action to be executed when the animation is interrupted.
public ComboAnimator SetOnInterrupted(UnityAction onInterrupted)
Parameters
onInterrupted
UnityActionThe action to be executed.
Returns
- ComboAnimator
The updated ComboAnimator.
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)
Evaluates what frame should be displayed based on the current cycle. This also handles the animation cycles.
public override void Tick(float deltaTime)
Parameters
deltaTime
float