AnimancerEvent.

AnimancerEvent.Sequence Class

Summary

A variable-size list of Animancer.AnimancerEvents which keeps itself sorted according to their Animancer.AnimancerEvent.normalizedTime.
Assembly
Animancer.dll
Namespace
Animancer
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IEnumerable<AnimancerEvent>"] Type["AnimancerEvent.Sequence"] class Type type-node

Syntax

public sealed class AnimancerEvent.Sequence : IEnumerable<AnimancerEvent>

Remarks

Animancer Lite does not allow events (except for ) in runtime builds.

Documentation: Animancer Events

Constructors

Name Summary
Sequence() Creates a new Animancer.AnimancerEvent.Sequence which starts at 0 Animancer.AnimancerEvent.Sequence.Capacity.

Adding anything to the sequence will set the Animancer.AnimancerEvent.Sequence.Capacity = Animancer.AnimancerEvent.Sequence.DefaultCapacity and then double it whenever the Animancer.AnimancerEvent.Sequence.Count would exceed the Animancer.AnimancerEvent.Sequence.Capacity.
Sequence(AnimancerEvent.Sequence) Creates a new Animancer.AnimancerEvent.Sequence and copies the contents of `copyFrom` into it.
Sequence(ICollection<AnimancerEvent>) [Pro-Only] Creates a new Animancer.AnimancerEvent.Sequence, copying and sorting the contents of the `collection` into it. The Animancer.AnimancerEvent.Sequence.Count and Animancer.AnimancerEvent.Sequence.Capacity will be equal to the System.Collections.Generic.ICollection`1.Count.
Sequence(IEnumerable<AnimancerEvent>) [Pro-Only] Creates a new Animancer.AnimancerEvent.Sequence, copying and sorting the contents of the `enumerable` into it.
Sequence(int) [Pro-Only] Creates a new Animancer.AnimancerEvent.Sequence which starts with the specified Animancer.AnimancerEvent.Sequence.Capacity. It will be initially empty, but will have room for the given number of elements before any reallocations are required.

Fields

Name Constant Value Summary
DefaultCapacity 8
The initial Animancer.AnimancerEvent.Sequence.Capacity that will be used if another value is not specified.
static
endEvent
A Animancer.AnimancerEvent.callback that will be triggered every frame after the Animancer.AnimancerEvent.normalizedTime has passed. If you want it to only get triggered once, you can either have the event clear itself or just use a regular event instead.

Interrupting the animation does not trigger this event.

By default, the Animancer.AnimancerEvent.normalizedTime will be System.Single.NaN so that it can choose the correct value based on the current play direction: forwards ends at 1 and backwards ends at 0.

Animancer Lite does not allow the to be changed in Runtime Builds.
NoEvents
A zero length array of Animancer.AnimancerEvents which is used by all sequence before any elements are added to them (unless their Animancer.AnimancerEvent.Sequence.Capacity is set manually).
static

Properties

Name Value Summary
Capacity int
[Pro-Only] The size of the internal array used to hold events.

When set, the array is reallocated to the given size.

By default, the Animancer.AnimancerEvent.Sequence.Capacity starts at 0 and increases to the Animancer.AnimancerEvent.Sequence.DefaultCapacity when the first event is added.
Count int
[Pro-Only] The number of events in this sequence (excluding the Animancer.AnimancerEvent.Sequence.endEvent).
IsEmpty bool
Indicates whether the sequence has any events in it (including the Animancer.AnimancerEvent.Sequence.endEvent).
Names string[]
[Pro-Only] The names of the events (excluding the Animancer.AnimancerEvent.Sequence.endEvent).
NormalizedEndTime float
[Pro-Only] Shorthand for endEvent.normalizedTime.
OnEnd Action
Shorthand for the endEvent.callback.
this[int] AnimancerEvent
[Pro-Only] Returns the event at the specified `index`.
this[string] AnimancerEvent
[Pro-Only] Returns the event with the specified `name`.
Version int
[Pro-Only] The number of times the contents of this sequence have been modified. This applies to general events, but not the Animancer.AnimancerEvent.Sequence.endEvent.

Methods

Name Value Summary
Add(AnimancerEvent) int
[Pro-Only] Adds the given event to this sequence. The Animancer.AnimancerEvent.Sequence.Count is increased by one and if required, the Animancer.AnimancerEvent.Sequence.Capacity is doubled to fit the new event.
Add(float, Action) int
[Pro-Only] Adds the given event to this sequence. The Animancer.AnimancerEvent.Sequence.Count is increased by one and if required, the Animancer.AnimancerEvent.Sequence.Capacity is doubled to fit the new event.
Add(int, AnimancerEvent) int
[Pro-Only] Adds the given event to this sequence. The Animancer.AnimancerEvent.Sequence.Count is increased by one and if required, the Animancer.AnimancerEvent.Sequence.Capacity is doubled to fit the new event.
Add(int, float, Action) int
[Pro-Only] Adds the given event to this sequence. The Animancer.AnimancerEvent.Sequence.Count is increased by one and if required, the Animancer.AnimancerEvent.Sequence.Capacity is doubled to fit the new event.
AddCallback(int, Action) void
[Pro-Only] Adds the specified `callback` to the Animancer.AnimancerEvent.callback of the event at the specified `index`.
AddCallback(string, Action) void
[Pro-Only] Adds the specified `callback` to the Animancer.AnimancerEvent.callback of the event with the specified `name`.
AddRange(IEnumerable<AnimancerEvent>) void
[Pro-Only] Adds every event in the `enumerable` to this sequence. The Animancer.AnimancerEvent.Sequence.Count is increased by one and if required, the Animancer.AnimancerEvent.Sequence.Capacity is doubled to fit the new event.
AssertNormalizedTimes(AnimancerState) void
[Assert-Conditional] Throws an System.ArgumentOutOfRangeException if the Animancer.AnimancerEvent.normalizedTime of any events is less than 0 or greater than or equal to 1.

This does not include the Animancer.AnimancerEvent.Sequence.endEvent since it works differently to other events.
AssertNormalizedTimes(AnimancerState, bool) void
[Assert-Conditional] Calls Animancer.AnimancerEvent.Sequence.AssertNormalizedTimes(Animancer.AnimancerState) if `isLooping` is true.
Clear() void
Removes all events, including the Animancer.AnimancerEvent.Sequence.endEvent.
CopyFrom(AnimancerEvent.Sequence) void
Copies all the events from the `source` to replace the previous contents of this sequence.
CopyTo(AnimancerEvent[], int) void
[System.Collections.Generic.ICollection`1] Copies all the events from this sequence into the `array`, starting at the `index`.
DeepToString(bool) string
Returns a string containing the details of all events in this sequence.
GetDefaultNormalizedEndTime(float) float
The default Animancer.AnimancerEvent.normalizedTime for an Animancer.AnimancerEvent.Sequence.endEvent when playing forwards is 1 (the end of the animation) and when playing backwards is 0 (the start of the animation).

`speed` 0 or System.Single.NaN will also return 1.
static
GetDefaultNormalizedStartTime(float) float
The default Animancer.AnimancerState.NormalizedTime for an animation to start at when playing forwards is 0 (the start of the animation) and when playing backwards is 1 (the end of the animation).

`speed` 0 or System.Single.NaN will also return 0.
static
GetEnumerator() AnimancerEvent.Sequence.Enumerator
[Pro-Only] Returns an Animancer.AnimancerEvent.Sequence.Enumerator for this sequence.
GetName(int) string
[Pro-Only] Returns the name of the event at the specified `index` or null if it is not included in the Animancer.AnimancerEvent.Sequence.Names.
IndexOf(string) int
[Pro-Only] Returns the index of the event with the specified `name` or -1 if there is no such event.
IndexOfRequired(string) int
[Pro-Only] Returns the index of the event with the specified `name` or throws an System.ArgumentException if there is no such event.
Remove(AnimancerEvent) bool
[Pro-Only] Removes the `animancerEvent` from this sequence by decrementing the Animancer.AnimancerEvent.Sequence.Count and copying all events after the removed one down one place. Returns true if the event was found and removed.
Remove(int) void
[Pro-Only] Removes the event at the specified `index` from this sequence by decrementing the Animancer.AnimancerEvent.Sequence.Count and copying all events after the removed one down one place.
Remove(string) bool
[Pro-Only] Removes the event with the specified `name` from this sequence by decrementing the Animancer.AnimancerEvent.Sequence.Count and copying all events after the removed one down one place. Returns true if the event was found and removed.
RemoveAll() void
[Pro-Only] Removes all events except the Animancer.AnimancerEvent.Sequence.endEvent.
SetCallback(int, Action) void
[Pro-Only] Replaces the Animancer.AnimancerEvent.callback of the event at the specified `index`.
SetCallback(string, Action) void
[Pro-Only] Replaces the Animancer.AnimancerEvent.callback of the event with the specified `name`.
SetName(int, string) void
[Pro-Only] Sets the name of the event at the specified `index`. If the Animancer.AnimancerEvent.Sequence.Names did not previously include that `index` it will be resized with a size equal to the Animancer.AnimancerEvent.Sequence.Count.