Esempio n. 1
0
 public TransitionDefinition(IAnimationDefinition parent, StateDefinition from, StateDefinition to, string name = null)
 {
     Name   = name ?? parent.Name;
     Parent = parent;
     From   = from;
     To     = to;
 }
        public VrcParameterDriverDefinition(StateDefinition parent, VRCAvatarParameterDriver driver)
        {
            Name      = parent.Name;
            Parent    = parent;
            Behaviour = driver;

            foreach (var driverParameter in driver.parameters)
            {
                AddParameter(driverParameter.name, nameof(VRCAvatarParameterDriver), true);
            }
        }
Esempio n. 3
0
        public TransitionDefinition(IAnimationDefinition parent, AnimatorTransitionBase transition, StateDefinition from, StateDefinition to)
        {
            StateTransition = transition;
            Name            = string.IsNullOrEmpty(transition.name) ? parent.Name : transition.name;
            Parent          = parent;
            From            = from;
            To = to;

            foreach (AnimatorCondition condition in transition.conditions)
            {
                AddCondition(condition);
            }
        }
        public StateMachineDefinition(IAnimationDefinition parent, AnimatorStateMachine stateMachine)
        {
            Parent = parent;
            if (stateMachine == null)
            {
                $"StateMachine of parent {parent.Name} is null!".LogError();
                return;
            }

            StateMachine = stateMachine;
            Name         = stateMachine.name;

            Entry = new StateDefinition(this, nameof(Entry))
            {
                Type = StateDefinition.StateType.Entry
            };
            Exit = new StateDefinition(this, nameof(Exit))
            {
                Type = StateDefinition.StateType.Exit
            };
            Any = new StateDefinition(this, nameof(Any))
            {
                Type = StateDefinition.StateType.Any
            };

            foreach (ChildAnimatorState childAnimatorState in stateMachine.states)
            {
                var state           = childAnimatorState.state;
                var stateDefinition = AddState(state);
                if (stateMachine.defaultState == state)
                {
                    DefaultState = stateDefinition;
                }

                foreach (AnimatorTransition transition in stateMachine.entryTransitions)
                {
                    if (transition.destinationState == state)
                    {
                        AddTransition(transition, Entry, stateDefinition);
                    }
                }

                foreach (AnimatorStateTransition transition in stateMachine.anyStateTransitions)
                {
                    if (transition.destinationState == state)
                    {
                        AddTransition(transition, Any, stateDefinition);
                    }
                }
            }
        }
 public StateMachineDefinition(IAnimationDefinition parent, string name = null)
 {
     Name   = name ?? parent.Name;
     Parent = parent;
     Entry  = new StateDefinition(this, nameof(Entry))
     {
         Type = StateDefinition.StateType.Entry
     };
     Exit = new StateDefinition(this, nameof(Exit))
     {
         Type = StateDefinition.StateType.Exit
     };
     Any = new StateDefinition(this, nameof(Any))
     {
         Type = StateDefinition.StateType.Any
     };
 }
 public TransitionDefinition AddTransition(StateDefinition from, StateDefinition to, string name = null)
 {
     return(Children.AddChild(new TransitionDefinition(this, from, to, name)));
 }
 public TransitionDefinition AddTransition(AnimatorTransitionBase transition, StateDefinition from, StateDefinition to)
 {
     return(Children.AddChild(new TransitionDefinition(this, transition, from, to)));
 }
 public static TransitionDefinition AddTransition(this IAnimationDefinition instance, StateDefinition from, StateDefinition to, string name = null)
 {
     return(instance.Children.AddChild(new TransitionDefinition(instance, from, to, name)));
 }