Пример #1
0
        public void SetNextState(IStateProvider provider)
        {
            var state = provider.CalculateState(avatar);

            Assert.IsFalse(nextState, $"Attempted to transition to state {state}, but we're already scheduled to transition to {nextState}!");
            Assert.AreNotEqual(currentState, state, $"Attempted to transition to state {state}, but we're already in that state!");
            nextState = state;
        }
Пример #2
0
 protected void OnValidate()
 {
     state = this;
     Assert.IsTrue(state);
     if (!timeline || timeline.name != name)
     {
         timeline = UnityEditor.AssetDatabase.LoadAssetAtPath <TimelineAsset>(timelinePath);
     }
     if (!animation || animation.name != name)
     {
         animation = UnityEditor.AssetDatabase.LoadAssetAtPath <AnimationClip>(animationPath);
     }
     if (!Enum.TryParse(name, out animationIndex))
     {
         animationIndex = AvatarAnimation.Unknown;
     }
 }
Пример #3
0
        void ApplyNextState()
        {
            currentState = nextState;

            avatar.physics.characterHitBox = currentState.characterHitBox;

            observedComponent.Stop();
            foreach (var binding in currentState.timeline.outputs)
            {
                observedComponent.SetGenericBinding(binding.sourceObject, FindBinding(binding));
            }
            observedComponent.playableAsset     = currentState.timeline;
            observedComponent.extrapolationMode = currentState.wrapMode;
            observedComponent.RebuildGraph();
            observedComponent.Play();
            observedComponent.playableGraph.Evaluate(0);
            nextState = null;
        }