Class AbstractAnimation
- Namespace
- FriedSynapse.FlowEnt
Provides animation specific behaviour
public abstract class AbstractAnimation : AbstractUpdatable, IControllable
- Inheritance
-
AbstractAnimation
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
AbstractAnimation()
Creates a new instance using FlowEntController.
protected AbstractAnimation()
Properties
AutoStart
public bool AutoStart { get; protected set; }
Property Value
Controllable
Returns the current animation cast as IControllable, which can be used to control the animation
public IControllable Controllable { get; }
Property Value
Overdraft
The amount of scaled time unconsumed by this animation from the last frame.
public float? Overdraft { get; }
Property Value
PlayState
The current state of the animation.
public PlayState PlayState { get; }
Property Value
TimeScale
public float TimeScale { get; set; }
Property Value
UpdateType
public UpdateType UpdateType { get; set; }
Property Value
Methods
AsAsync(CancellationToken?)
Provides a task that can be awaited. The task completes when the animation ends.
public Task AsAsync(CancellationToken? token = null)
Parameters
tokenCancellationToken?
Returns
Conditional(Func<bool>, Action<AbstractAnimation>)
Executes the onConditionTrue if condition returns true.
public AbstractAnimation Conditional(Func<bool> condition, Action<AbstractAnimation> onConditionTrue)
Parameters
conditionFunc<bool>The condition.
onConditionTrueAction<AbstractAnimation>The callback.
Returns
ConditionalInternal<TAnimation>(Func<bool>, Action<TAnimation>)
Executes the onConditionTrue if condition returns true.
protected TAnimation ConditionalInternal<TAnimation>(Func<bool> condition, Action<TAnimation> onConditionTrue) where TAnimation : AbstractAnimation
Parameters
Returns
- TAnimation
Type Parameters
TAnimation
OnCompleted(Action)
Adds an event called when the animation has completed.
public AbstractAnimation OnCompleted(Action callback)
Parameters
callbackActionThe event.
Returns
OnCompleting(Action)
Adds an event called when the animation is completing.
public AbstractAnimation OnCompleting(Action callback)
Parameters
callbackActionThe event.
Returns
OnLoopCompleted(Action<int?>)
Adds an event called when the animation loop has completed.
public AbstractAnimation OnLoopCompleted(Action<int?> callback)
Parameters
callbackAction<int?>The event. The parameter represents the number of loops left. If there are infinite loops it'll send a null param.
Returns
OnLoopStarted(Action<int?>)
Adds an event called when the animation loop has started.
public AbstractAnimation OnLoopStarted(Action<int?> callback)
Parameters
callbackAction<int?>The event. The parameter represents the number of loops left. If there are infinite loops it'll send a null param.
Returns
OnStarted(Action)
Adds an event called when the animation has started.
public AbstractAnimation OnStarted(Action callback)
Parameters
callbackActionThe event.
Returns
OnStarting(Action)
Adds an event called when the animation is starting.
public AbstractAnimation OnStarting(Action callback)
Parameters
callbackActionThe event.
Returns
OnUpdated(Action<float>)
Adds an event called when the animation has updated.
public AbstractAnimation OnUpdated(Action<float> callback)
Parameters
Returns
OnUpdating(Action<float>)
Adds an event called when the animation is updating.
public AbstractAnimation OnUpdating(Action<float> callback)
Parameters
Returns
Pause()
Pauses the animation.
public AbstractAnimation Pause()
Returns
Reset()
Resets the animation so in can be replayed.
public AbstractAnimation Reset()
Returns
Exceptions
- AnimationException
If the animation is not finished.
ResetInternal()
protected override void ResetInternal()
Resume()
Resumes the animation.
public AbstractAnimation Resume()
Returns
SetAutoStart(bool)
Sets whether this animation should auto-start or not.
public AbstractAnimation SetAutoStart(bool autoStart)
Parameters
autoStartbool
Returns
Remarks
Auto-start will be slower than a true-start. See more at https://flowent.friedsynapse.com/tips#h.s5cucrg5qyjc
SetDelay(float)
Sets the amount of time in seconds that you want to delay when this animation is started.
public AbstractAnimation SetDelay(float time)
Parameters
timefloat
Returns
SetDelayUntil(Func<bool>)
Sets the callback that holds the starting of this animation.
public AbstractAnimation SetDelayUntil(Func<bool> callback)
Parameters
Returns
SetEvents(AbstractAnimationEvents)
protected void SetEvents(AbstractAnimationEvents events)
Parameters
eventsAbstractAnimationEvents
SetLoopCount(int?)
Sets the amount of loops you want this animation to have. If you want infinite loops pass a null value.
public AbstractAnimation SetLoopCount(int? loopCount)
Parameters
loopCountint?
Returns
Remarks
Flows only have reset loop types.
SetName(string)
Sets the name of the animation.
public AbstractAnimation SetName(string name)
Parameters
namestring
Returns
SetOptions(AbstractAnimationOptions)
protected void SetOptions(AbstractAnimationOptions options)
Parameters
optionsAbstractAnimationOptions
SetSkipFrames(int)
Sets the amount of frames you want to skip at when this animation is started.
public AbstractAnimation SetSkipFrames(int frames)
Parameters
framesint
Returns
SetTimeScale(float)
Sets the time scale for the current animation.
public AbstractAnimation SetTimeScale(float timeScale)
Parameters
timeScalefloat
Returns
SetUpdateType(UpdateType)
Sets the update type for the animation.
public AbstractAnimation SetUpdateType(UpdateType updateType)
Parameters
updateTypeUpdateType
Returns
SetWaitFor(params AbstractAnimation[])
Sets the animation that holds the starting of this animation.
public AbstractAnimation SetWaitFor(params AbstractAnimation[] animations)
Parameters
animationsAbstractAnimation[]
Returns
Start()
Starts the animation.
public AbstractAnimation Start()
Returns
StartAsync(CancellationToken?)
Starts the animation async(you can await this till the animation finishes).
public Task<AbstractAnimation> StartAsync(CancellationToken? token = null)
Parameters
tokenCancellationToken?The cancellation doesn't cancel the task, but rather terminates the animation. The task will be completed
Returns
Stop(bool)
Stops the animation.
public AbstractAnimation Stop(bool triggerOnCompleted = false)
Parameters
triggerOnCompletedboolIf set to true will trigger the "OnCompleted" event on the animation
Returns
StopInternal(bool)
protected override void StopInternal(bool triggerOnCompleted)
Parameters
triggerOnCompletedbool