Summary
A system for synchronizing the
Animancer.AnimancerState.NormalizedTime of certain animations.- Assembly
- Animancer
.dll - Namespace
- Animancer
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type["TimeSynchronizer<T>"]
class Type type-node
Syntax
public class TimeSynchronizer<T>
Examples
Example: Character Controller -> Synchronization
public enum AnimationType
{
None,
Movement,
}
[SerializeField] private AnimancerComponent _Animancer;
// 1. Store a TimeSynchronizer in a field.
private readonly TimeSynchronizer<AnimationType>
TimeSynchronizer = new TimeSynchronizer<AnimationType>();
public AnimancerState Play(AnimationClip clip, AnimationType type)
{
// 2. Call any of the StoreTime methods before playing a new animation.
TimeSynchronizer.StoreTime(_Animancer);
// 3. Play an animation.
var state = _Animancer.Play(clip);
// 4. Call any of the SyncTime methods after playing the animation.
// If the `type` was the same as the value from last time you called it,
// the state's NormalizedTime will be set to the stored value.
TimeSynchronizer.SyncTime(state, type);
return state;
}
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
| Name | Summary |
|---|---|
| TimeSynchronizer |
Creates a new Animancer.TimeSynchronizer`1. |
| TimeSynchronizer |
Creates a new Animancer.TimeSynchronizer`1. |
Properties
| Name | Value | Summary |
|---|---|---|
| CurrentGroup | T |
The group that the current animation is in.
|
| NormalizedTime | double |
The stored
Animancer.AnimancerState.NormalizedTimeD. |
| Synchronize |
bool |
Should synchronization be applied when the
Animancer.TimeSynchronizer`1.CurrentGroup is at its default value? |
Methods
| Name | Value | Summary |
|---|---|---|
| StoreTime |
void |
Stores the
Animancer.AnimancerState.NormalizedTimeD of the Animancer.AnimancerLayer.CurrentState.
|
| StoreTime |
void |
Stores the
Animancer.AnimancerState.NormalizedTimeD of the `state`. |
| SyncTime |
bool |
Applies the
Animancer.TimeSynchronizer`1.NormalizedTime to the Animancer.AnimancerLayer.CurrentState if the `group`
matches the Animancer.TimeSynchronizer`1.CurrentGroup.
|
| SyncTime |
bool |
Applies the
Animancer.TimeSynchronizer`1.NormalizedTime to the Animancer.AnimancerLayer.CurrentState if the `group`
matches the Animancer.TimeSynchronizer`1.CurrentGroup.
|
| SyncTime |
bool |
Applies the
Animancer.TimeSynchronizer`1.NormalizedTime to the `state` if the `group` matches the
Animancer.TimeSynchronizer`1.CurrentGroup.
|
| SyncTime |
bool |
Applies the
Animancer.TimeSynchronizer`1.NormalizedTime to the `state` if the `group` matches the
Animancer.TimeSynchronizer`1.CurrentGroup.
|