12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using UnityEngine.Playables;
- namespace Animancer
- {
-
- partial class AnimancerState
- {
-
-
-
- public class DelayedPause : Key, IUpdatable
- {
-
-
- public AnimancerPlayable Root { get; set; }
-
- public AnimancerState State { get; set; }
-
-
-
-
- public static void Register(AnimancerState state)
- {
- var root = state.Root;
- if (root == null)
- return;
- var pause = ObjectPool.Acquire<DelayedPause>();
- pause.Root = root;
- pause.State = state;
- root.RequirePostUpdate(pause);
- }
-
-
-
-
-
- public void Update()
- {
- if (!State.IsPlaying)
- State._Playable.Pause();
- Root.CancelPostUpdate(this);
- Root = null;
- State = null;
- ObjectPool.Release(this);
- }
-
- }
- }
- }
|