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-.->Interface1["ICopyable<AnimancerEvent.Sequence>"] Type["AnimancerEvent.Sequence"] class Type type-node

Syntax

public class AnimancerEvent.Sequence : IEnumerable<AnimancerEvent>, 
    ICopyable<AnimancerEvent.Sequence>

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(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

Properties

Name Value Summary
Capacity int
[Pro-Only] The size of the internal array used to hold events.
Count int
[Pro-Only] The number of events in this sequence (excluding the Animancer.AnimancerEvent.Sequence.EndEvent).
EndEvent AnimancerEvent
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.
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.
ShouldNotModifyReason string
[Assert-Only] If this property is set, any attempt to modify this sequence will trigger Animancer.OptionalWarning.LockedEvents (which will include this value in its message).
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.
AddAllEvents(AnimationClip) void
[Pro-Only] Copies the UnityEngine.AnimationClip.events into this Animancer.AnimancerEvent.Sequence.
AddCallback(int, Action) void
[Pro-Only] Adds the specified `callback` to the event at the specified `index`.
AddCallback(string, Action) void
[Pro-Only] Adds the specified `callback` to 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.
ContentsAreEqual(AnimancerEvent.Sequence) bool
Are all events in this sequence identical to the ones in the `other` sequence?
CopyFrom(AnimancerEvent.Sequence) void
Copies the contents of `copyFrom` into this object, replacing its previous contents.
CopyTo(AnimancerEvent[], int) void
[System.Collections.Generic.ICollection`1] [Pro-Only] 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() FastEnumerator<AnimancerEvent>
[Pro-Only] Returns a Animancer.FastEnumerator`1 for the events in this sequence excluding the Animancer.AnimancerEvent.Sequence.EndEvent.
GetName(int) string
[Pro-Only] Returns the name of the event at the specified `index` or null if it is outside of the Animancer.AnimancerEvent.Sequence.Names array.
GetRealNormalizedEndTime(float) float
[Pro-Only] Returns the Animancer.AnimancerEvent.Sequence.NormalizedEndTime but converts System.Single.NaN to its corresponding default value: positive speed ends at 1 and negative speed ends at 0.
IndexOf(AnimancerEvent) int
[Pro-Only] Returns the index of the `animancerEvent` or -1 if there is no such event.
IndexOf(int, AnimancerEvent) int
[Pro-Only] Returns the index of the `animancerEvent` or -1 if there is no such event.
IndexOf(string, int) int
[Pro-Only] Returns the index of the event with the specified `name` or -1 if there is no such event.
IndexOfRequired(AnimancerEvent) int
[Pro-Only] Returns the index of the `animancerEvent`.
IndexOfRequired(int, AnimancerEvent) int
[Pro-Only] Returns the index of the `animancerEvent`.
IndexOfRequired(string, int) int
[Pro-Only] Returns the index of the event with the specified `name`.
OnSequenceModified() void
[Assert-Conditional] Logs Animancer.OptionalWarning.LockedEvents if necessary.
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.
RemoveCallback(int, Action) void
[Pro-Only] Removes the specified `callback` from the event at the specified `index`.
RemoveCallback(string, Action) void
[Pro-Only] Removes the specified `callback` from the event with the specified `name`.
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.
SetNormalizedTime(AnimancerEvent, float) int
[Pro-Only] Sets the Animancer.AnimancerEvent.normalizedTime of the matching `animancerEvent`.
SetNormalizedTime(int, float) int
[Pro-Only] Sets the Animancer.AnimancerEvent.normalizedTime of the event at the specified `index`.
SetNormalizedTime(string, float) int
[Pro-Only] Sets the Animancer.AnimancerEvent.normalizedTime of the event with the specified `name`.
SetShouldNotModifyReason(string) void
[Assert-Conditional] Sets the Animancer.AnimancerEvent.Sequence.ShouldNotModifyReason for Animancer.OptionalWarning.LockedEvents.