コード例 #1
0
        private AnimatorStateTransition(AnimatorStateMachine sm, AnimatorState parentSate, UnityEditor.Animations.AnimatorTransitionBase t)
        {
            this.stateMachine = sm;
            this.parentSate   = parentSate;
            this.asset        = t;

            this.solo   = t.solo;
            this.mute   = t.mute;
            this.isExit = t.isExit;

            this.destinationState        = t.destinationState == null ? 0 : sm.layer.stateMap[t.destinationState];
            this.destinationStateMachine = t.destinationStateMachine == null ? 0 : sm.layer.stateMachineMap[t.destinationStateMachine];
            //if (t.destinationState != null && !sm.asset.stateMachines.Any(p => p.stateMachine == t.destinationState)) {
            //    this.destinationStateMachine = sm.layer.stateMachineMap[sm.layer.stateToMachineMap[t.destinationState]];
            //}
            foreach (var c in t.conditions)
            {
                this.conditions.Add(new AnimatorCondition(this, c));
            }
        }
コード例 #2
0
        public AnimatorState(AnimatorStateMachine sm, UnityEditor.Animations.AnimatorState s)
        {
            this.parent = sm;
            this.asset  = s;

            this.name     = s.name;
            this.fullPath = sm.fullPath + "." + s.name;
            this.id       = UnityEngine.Animator.StringToHash(fullPath);
            sm.layer.states.Add(this);

            //this.nameHash = s.nameHash;
            if (s.motion != null)
            {
                var m = new Motion(s.motion);
                if (m.clip != null || m.children.Count > 0)
                {
                    this.motion = m;
                }
            }
            this.speed              = s.speed;
            this.cycleOffset        = s.cycleOffset;
            this.mirror             = s.mirror;
            this.writeDefaultValues = s.writeDefaultValues;
            //this.speedParameter = s.speedParameterActive ? ac.parameters.First(p => p.name == s.speedParameter).nameHash : 0;
            //this.cycleOffsetParameter = s.cycleOffsetParameterActive ? ac.parameters.First(p => p.name == s.cycleOffsetParameter).nameHash : 0;
            //this.mirrorParameter = s.mirrorParameterActive ? ac.parameters.First(p => p.name == s.mirrorParameter).nameHash : 0;
            //this.timeParameter = s.timeParameterActive ? ac.parameters.First(p => p.name == s.timeParameter).nameHash : 0;
            this.speedParameter       = s.speedParameterActive ? s.speedParameter : null;
            this.cycleOffsetParameter = s.cycleOffsetParameterActive ? s.cycleOffsetParameter : null;
            this.mirrorParameter      = s.mirrorParameterActive ? s.mirrorParameter : null;
            this.timeParameter        = s.timeParameterActive ? s.timeParameter : null;
            foreach (var t in s.transitions)
            {
                this.transitions.Add(new AnimatorStateTransition(sm, this, t));
            }
        }
コード例 #3
0
 public AnimatorStateTransition(AnimatorStateMachine sm, AnimatorState parentSate, UnityEditor.Animations.AnimatorTransition t)
     : this(sm, parentSate, (UnityEditor.Animations.AnimatorTransitionBase)t)
 {
 }