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
token
CancellationToken?
Returns
Conditional(Func<bool>, Action<AbstractAnimation>)
Executes the onConditionTrue
if condition
returns true.
public AbstractAnimation Conditional(Func<bool> condition, Action<AbstractAnimation> onConditionTrue)
Parameters
condition
Func<bool>The condition.
onConditionTrue
Action<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
callback
ActionThe event.
Returns
OnCompleting(Action)
Adds an event called when the animation is completing.
public AbstractAnimation OnCompleting(Action callback)
Parameters
callback
ActionThe event.
Returns
OnLoopCompleted(Action<int?>)
Adds an event called when the animation loop has completed.
public AbstractAnimation OnLoopCompleted(Action<int?> callback)
Parameters
callback
Action<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
callback
Action<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
callback
ActionThe event.
Returns
OnStarting(Action)
Adds an event called when the animation is starting.
public AbstractAnimation OnStarting(Action callback)
Parameters
callback
ActionThe 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
autoStart
bool
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
time
float
Returns
SetDelayUntil(Func<bool>)
Sets the callback that holds the starting of the animation.
public AbstractAnimation SetDelayUntil(Func<bool> callback)
Parameters
Returns
SetEvents(AbstractAnimationEvents)
protected void SetEvents(AbstractAnimationEvents events)
Parameters
events
AbstractAnimationEvents
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
loopCount
int?
Returns
Remarks
Flows only have reset loop types.
SetName(string)
Sets the name of the animation.
public AbstractAnimation SetName(string name)
Parameters
name
string
Returns
SetOptions(AbstractAnimationOptions)
protected void SetOptions(AbstractAnimationOptions options)
Parameters
options
AbstractAnimationOptions
SetSkipFrames(int)
Sets the amount of frames you want to skip at when this animation is started.
public AbstractAnimation SetSkipFrames(int frames)
Parameters
frames
int
Returns
SetTimeScale(float)
Sets the time scale for the current animation.
public AbstractAnimation SetTimeScale(float timeScale)
Parameters
timeScale
float
Returns
SetUpdateType(UpdateType)
Sets the update type for the animation.
public AbstractAnimation SetUpdateType(UpdateType updateType)
Parameters
updateType
UpdateType
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
token
CancellationToken?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
triggerOnCompleted
boolIf set to true will trigger the "OnCompleted" event on the animation
Returns
StopInternal(bool)
protected override void StopInternal(bool triggerOnCompleted)
Parameters
triggerOnCompleted
bool