Esempio n. 1
0
        public StateDefinition(StateMachineDefinition parent, AnimatorState state) : this(parent)
        {
            Name  = state.name;
            State = state;
            AddMotion(state.motion);

            foreach (VRCAvatarParameterDriver vrcAvatarParameterDriver in state.behaviours.OfType <VRCAvatarParameterDriver>())
            {
                AddParameterDriverDefinition(vrcAvatarParameterDriver);
            }

            foreach (var transition in state.transitions)
            {
                if (transition.destinationState == null)
                {
                    continue;
                }

                var from = this;
                var to   = parent.GetState(transition.destinationState.name);
                if (to == null)
                {
                    continue;
                }

                AddTransition(transition, from, to);
            }

            if (state.speedParameterActive)
            {
                SpeedParameter = AddParameter(state.speedParameter, nameof(state.speedParameter), true);
            }

            if (state.mirrorParameterActive)
            {
                MirrorParameter = AddParameter(state.mirrorParameter, nameof(state.mirrorParameter), true);
            }

            if (state.timeParameterActive)
            {
                TimeParameter = AddParameter(state.timeParameter, nameof(state.timeParameter), true);
            }

            if (state.cycleOffsetParameterActive)
            {
                CycleOffsetParameter = AddParameter(state.cycleOffsetParameter, nameof(state.cycleOffsetParameter), true);
            }
        }
Esempio n. 2
0
 public StateDefinition(StateMachineDefinition parent, string name = null)
 {
     Name   = name ?? parent.Name;
     Parent = parent;
 }