Beispiel #1
0
        public Motion(UnityEngine.Motion m)
        {
            switch (m)
            {
            case UnityEditor.Animations.BlendTree bt: {
                this.btAsset         = bt;
                this.type            = 1;
                this.blendType       = (int)bt.blendType;
                this.blendParameter  = bt.blendParameter;
                this.blendParameterY = bt.blendParameterY;
                this.children        = new List <ChildMotion>();
                foreach (var cm in bt.children)
                {
                    if (cm.motion == null)
                    {
                        continue;
                    }
                    var c = new ChildMotion(this, cm);
                    if (c.motion == null)
                    {
                        continue;
                    }
                    this.children.Add(c);
                }
                break;
            }

            case UnityEngine.AnimationClip ac: {
                this.type = 0;
                this.clip = ac.name;
                break;
            }
            }
        }
Beispiel #2
0
        public AnimatorState CreateBlendTreeInController(string name, out UnityEditor.Animations.BlendTree tree, int layerIndex)
        {
            tree      = new UnityEditor.Animations.BlendTree();
            tree.name = name;
            string defaultBlendTreeParameter = this.GetDefaultBlendTreeParameter();

            tree.blendParameterY = defaultBlendTreeParameter;
            tree.blendParameter  = defaultBlendTreeParameter;
            if (AssetDatabase.GetAssetPath(this) != string.Empty)
            {
                AssetDatabase.AddObjectToAsset(tree, AssetDatabase.GetAssetPath(this));
            }
            AnimatorState state = this.layers[layerIndex].stateMachine.AddState(tree.name);

            state.motion = tree;
            return(state);
        }
Beispiel #3
0
        private static AnimationClip GetFirstAnimationClipFromMotion(Motion motion)
        {
            AnimationClip animationClip = motion as AnimationClip;

            if ((bool)((Object)animationClip))
            {
                return(animationClip);
            }
            UnityEditor.Animations.BlendTree blendTree = motion as UnityEditor.Animations.BlendTree;
            if ((bool)((Object)blendTree))
            {
                AnimationClip[] animationClipsFlattened = blendTree.GetAnimationClipsFlattened();
                if (animationClipsFlattened.Length > 0)
                {
                    return(animationClipsFlattened[0]);
                }
            }
            return((AnimationClip)null);
        }
Beispiel #4
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_21500            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

            // If we find the sm with our name, remove it
            for (int i = 0; i < lRootStateMachine.stateMachines.Length; i++)
            {
                // Look for a sm with the matching name
                if (lRootStateMachine.stateMachines[i].stateMachine.name == _EditorAnimatorSMName)
                {
                    lRootSubStateMachine = lRootStateMachine.stateMachines[i].stateMachine;

                    // Allow the user to stop before we remove the sm
                    if (!UnityEditor.EditorUtility.DisplayDialog("Motion Controller", _EditorAnimatorSMName + " already exists. Delete and recreate it?", "Yes", "No"))
                    {
                        return;
                    }

                    // Remove the sm
                    //lRootStateMachine.RemoveStateMachine(lRootStateMachine.stateMachines[i].stateMachine);
                    break;
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lSM_21546 = lRootSubStateMachine;
            if (lSM_21546 != null)
            {
                for (int i = lSM_21546.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_21546.RemoveEntryTransition(lSM_21546.entryTransitions[i]);
                }

                for (int i = lSM_21546.anyStateTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_21546.RemoveAnyStateTransition(lSM_21546.anyStateTransitions[i]);
                }

                for (int i = lSM_21546.states.Length - 1; i >= 0; i--)
                {
                    lSM_21546.RemoveState(lSM_21546.states[i].state);
                }

                for (int i = lSM_21546.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_21546.RemoveStateMachine(lSM_21546.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_21546 = lSM_21500.AddStateMachine(_EditorAnimatorSMName, new Vector3(192, -696, 0));
            }

            UnityEditor.Animations.AnimatorState lS_22652 = lSM_21546.AddState("IdlePose", new Vector3(504, 72, 0));
            lS_22652.speed  = 1f;
            lS_22652.motion = m14306;

            UnityEditor.Animations.AnimatorState lS_21796 = lSM_21546.AddState("Move Tree", new Vector3(264, 72, 0));
            lS_21796.speed = 1f;

            UnityEditor.Animations.BlendTree lM_15642 = CreateBlendTree("Blend Tree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_15642.blendType       = UnityEditor.Animations.BlendTreeType.FreeformCartesian2D;
            lM_15642.blendParameter  = "InputX";
            lM_15642.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_15642.useAutomaticThresholds = true;
#endif
            lM_15642.AddChild(m14708, new Vector2(0f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_0_Children = lM_15642.children;
            lM_15642_0_Children[lM_15642_0_Children.Length - 1].mirror    = false;
            lM_15642_0_Children[lM_15642_0_Children.Length - 1].timeScale = 1.2f;
            lM_15642.children = lM_15642_0_Children;

            lM_15642.AddChild(m14710, new Vector2(-0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_1_Children = lM_15642.children;
            lM_15642_1_Children[lM_15642_1_Children.Length - 1].mirror    = false;
            lM_15642_1_Children[lM_15642_1_Children.Length - 1].timeScale = 1.1f;
            lM_15642.children = lM_15642_1_Children;

            lM_15642.AddChild(m14712, new Vector2(0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_2_Children = lM_15642.children;
            lM_15642_2_Children[lM_15642_2_Children.Length - 1].mirror    = false;
            lM_15642_2_Children[lM_15642_2_Children.Length - 1].timeScale = 1.1f;
            lM_15642.children = lM_15642_2_Children;

            lM_15642.AddChild(m14716, new Vector2(-0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_15642_3_Children = lM_15642.children;
            lM_15642_3_Children[lM_15642_3_Children.Length - 1].mirror    = false;
            lM_15642_3_Children[lM_15642_3_Children.Length - 1].timeScale = 1.1f;
            lM_15642.children = lM_15642_3_Children;

            lM_15642.AddChild(m14714, new Vector2(0f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_15642_4_Children = lM_15642.children;
            lM_15642_4_Children[lM_15642_4_Children.Length - 1].mirror    = false;
            lM_15642_4_Children[lM_15642_4_Children.Length - 1].timeScale = 1.3f;
            lM_15642.children = lM_15642_4_Children;

            lM_15642.AddChild(m14718, new Vector2(0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_15642_5_Children = lM_15642.children;
            lM_15642_5_Children[lM_15642_5_Children.Length - 1].mirror    = false;
            lM_15642_5_Children[lM_15642_5_Children.Length - 1].timeScale = 1.5f;
            lM_15642.children = lM_15642_5_Children;

            lM_15642.AddChild(m14704, new Vector2(-0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_6_Children = lM_15642.children;
            lM_15642_6_Children[lM_15642_6_Children.Length - 1].mirror    = false;
            lM_15642_6_Children[lM_15642_6_Children.Length - 1].timeScale = 1.5f;
            lM_15642.children = lM_15642_6_Children;

            lM_15642.AddChild(m14706, new Vector2(0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_7_Children = lM_15642.children;
            lM_15642_7_Children[lM_15642_7_Children.Length - 1].mirror    = false;
            lM_15642_7_Children[lM_15642_7_Children.Length - 1].timeScale = 1.5f;
            lM_15642.children = lM_15642_7_Children;

            lM_15642.AddChild(m14702, new Vector2(0f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_15642_8_Children = lM_15642.children;
            lM_15642_8_Children[lM_15642_8_Children.Length - 1].mirror    = false;
            lM_15642_8_Children[lM_15642_8_Children.Length - 1].timeScale = 1.5f;
            lM_15642.children = lM_15642_8_Children;

            lS_21796.motion = lM_15642;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_21654 = lRootStateMachine.AddAnyStateTransition(lS_21796);
            lT_21654.hasExitTime         = false;
            lT_21654.hasFixedDuration    = true;
            lT_21654.exitTime            = 0.9f;
            lT_21654.duration            = 0.2f;
            lT_21654.offset              = 0f;
            lT_21654.mute                = false;
            lT_21654.solo                = false;
            lT_21654.canTransitionToSelf = true;
            lT_21654.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_21654.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 620f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_22654 = lS_21796.AddTransition(lS_22652);
            lT_22654.hasExitTime         = false;
            lT_22654.hasFixedDuration    = true;
            lT_22654.exitTime            = 0.9f;
            lT_22654.duration            = 0.2f;
            lT_22654.offset              = 0f;
            lT_22654.mute                = false;
            lT_22654.solo                = false;
            lT_22654.canTransitionToSelf = true;
            lT_22654.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_22654.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 610f, "L0MotionPhase");
        }
Beispiel #5
0
        /// <summary>
        /// New way to create sub-state machines without destroying what exists first.
        /// </summary>
        protected override void CreateStateMachine()
        {
            int rLayerIndex = mMotionLayer._AnimatorLayerIndex;
            MotionController rMotionController = mMotionController;

            UnityEditor.Animations.AnimatorController lController = null;

            Animator lAnimator = rMotionController.Animator;

            if (lAnimator == null)
            {
                lAnimator = rMotionController.gameObject.GetComponent <Animator>();
            }
            if (lAnimator != null)
            {
                lController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
            }
            if (lController == null)
            {
                return;
            }

            while (lController.layers.Length <= rLayerIndex)
            {
                UnityEditor.Animations.AnimatorControllerLayer lNewLayer = new UnityEditor.Animations.AnimatorControllerLayer();
                lNewLayer.name         = "Layer " + (lController.layers.Length + 1);
                lNewLayer.stateMachine = new UnityEditor.Animations.AnimatorStateMachine();
                lController.AddLayer(lNewLayer);
            }

            UnityEditor.Animations.AnimatorControllerLayer lLayer = lController.layers[rLayerIndex];

            UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine;

            UnityEditor.Animations.AnimatorStateMachine lSSM_37924 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicWalkRunPivot-SM");
            if (lSSM_37924 == null)
            {
                lSSM_37924 = lLayerStateMachine.AddStateMachine("BasicWalkRunPivot-SM", new Vector3(408, -1056, 0));
            }

            UnityEditor.Animations.AnimatorState lState_38400 = MotionControllerMotion.EditorFindState(lSSM_37924, "Unarmed BlendTree");
            if (lState_38400 == null)
            {
                lState_38400 = lSSM_37924.AddState("Unarmed BlendTree", new Vector3(312, 72, 0));
            }
            lState_38400.speed  = 1f;
            lState_38400.mirror = false;
            lState_38400.tag    = "";

            UnityEditor.Animations.BlendTree lM_25576 = MotionControllerMotion.EditorCreateBlendTree("Blend Tree", lController, rLayerIndex);
            lM_25576.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_25576.blendParameter  = "InputMagnitude";
            lM_25576.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_25576.useAutomaticThresholds = false;
#endif
            lM_25576.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Idling/unity_Idle_IdleToIdlesR.fbx", "IdlePose"), 0f);
            lM_25576.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Walking/unity_WalkFWD_v2.fbx", "WalkForward"), 0.5f);
            lM_25576.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Running/RunForward_v2.fbx", "RunForward"), 1f);
            lState_38400.motion = lM_25576;

            UnityEditor.Animations.AnimatorStateTransition lAnyTransition_38110 = MotionControllerMotion.EditorFindAnyStateTransition(lLayerStateMachine, lState_38400, 0);
            if (lAnyTransition_38110 == null)
            {
                lAnyTransition_38110 = lLayerStateMachine.AddAnyStateTransition(lState_38400);
            }
            lAnyTransition_38110.isExit              = false;
            lAnyTransition_38110.hasExitTime         = false;
            lAnyTransition_38110.hasFixedDuration    = true;
            lAnyTransition_38110.exitTime            = 0.75f;
            lAnyTransition_38110.duration            = 0.25f;
            lAnyTransition_38110.offset              = 0f;
            lAnyTransition_38110.mute                = false;
            lAnyTransition_38110.solo                = false;
            lAnyTransition_38110.canTransitionToSelf = true;
            lAnyTransition_38110.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lAnyTransition_38110.conditions.Length - 1; i >= 0; i--)
            {
                lAnyTransition_38110.RemoveCondition(lAnyTransition_38110.conditions[i]);
            }
            lAnyTransition_38110.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 3050f, "L" + rLayerIndex + "MotionPhase");
            lAnyTransition_38110.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L" + rLayerIndex + "MotionForm");

#if USE_ARCHERY_MP || OOTII_AYMP
            ArcheryPackDefinition.ExtendBasicWalkRunPivot(rMotionController, rLayerIndex);
#endif

#if USE_SWORD_SHIELD_MP || OOTII_SSMP
            SwordShieldPackDefinition.ExtendBasicWalkRunPivot(rMotionController, rLayerIndex);
#endif

#if USE_SPELL_CASTING_MP || OOTII_SCMP
            SpellCastingPackDefinition.ExtendBasicWalkRunPivot(rMotionController, rLayerIndex);
#endif

#if USE_SHOOTER_MP || OOTII_SHMP
            ShooterPackDefinition.ExtendBasicWalkRunPivot(rMotionController, rLayerIndex);
#endif

            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #6
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_24530            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

            // If we find the sm with our name, remove it
            for (int i = 0; i < lRootStateMachine.stateMachines.Length; i++)
            {
                // Look for a sm with the matching name
                if (lRootStateMachine.stateMachines[i].stateMachine.name == _EditorAnimatorSMName)
                {
                    lRootSubStateMachine = lRootStateMachine.stateMachines[i].stateMachine;

                    // Allow the user to stop before we remove the sm
                    if (!UnityEditor.EditorUtility.DisplayDialog("Motion Controller", _EditorAnimatorSMName + " already exists. Delete and recreate it?", "Yes", "No"))
                    {
                        return;
                    }

                    // Remove the sm
                    //lRootStateMachine.RemoveStateMachine(lRootStateMachine.stateMachines[i].stateMachine);
                    break;
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lSM_24570 = lRootSubStateMachine;
            if (lSM_24570 != null)
            {
                for (int i = lSM_24570.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_24570.RemoveEntryTransition(lSM_24570.entryTransitions[i]);
                }

                for (int i = lSM_24570.anyStateTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_24570.RemoveAnyStateTransition(lSM_24570.anyStateTransitions[i]);
                }

                for (int i = lSM_24570.states.Length - 1; i >= 0; i--)
                {
                    lSM_24570.RemoveState(lSM_24570.states[i].state);
                }

                for (int i = lSM_24570.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_24570.RemoveStateMachine(lSM_24570.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_24570 = lSM_24530.AddStateMachine(_EditorAnimatorSMName, new Vector3(408, -756, 0));
            }

            UnityEditor.Animations.AnimatorState lS_25730 = lSM_24570.AddState("IdlePose", new Vector3(600, 120, 0));
            lS_25730.speed  = 1f;
            lS_25730.motion = m14552;

            UnityEditor.Animations.AnimatorState lS_24896 = lSM_24570.AddState("Move Tree", new Vector3(312, 120, 0));
            lS_24896.speed = 1f;

            UnityEditor.Animations.BlendTree lM_24106 = CreateBlendTree("Move Blend Tree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_24106.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_24106.blendParameter  = "InputMagnitude";
            lM_24106.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_24106.useAutomaticThresholds = false;
#endif
            lM_24106.AddChild(m14552, 0f);

            UnityEditor.Animations.BlendTree lM_24146 = CreateBlendTree("WalkTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_24146.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_24146.blendParameter  = "InputX";
            lM_24146.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_24146.useAutomaticThresholds = true;
#endif
            lM_24146.AddChild(m20884, new Vector2(0f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_0_Children = lM_24146.children;
            lM_24146_0_Children[lM_24146_0_Children.Length - 1].mirror    = false;
            lM_24146_0_Children[lM_24146_0_Children.Length - 1].timeScale = 1.1f;
            lM_24146.children = lM_24146_0_Children;

            lM_24146.AddChild(m20104, new Vector2(0.35f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_1_Children = lM_24146.children;
            lM_24146_1_Children[lM_24146_1_Children.Length - 1].mirror    = false;
            lM_24146_1_Children[lM_24146_1_Children.Length - 1].timeScale = 1.2f;
            lM_24146.children = lM_24146_1_Children;

            lM_24146.AddChild(m20102, new Vector2(-0.35f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_2_Children = lM_24146.children;
            lM_24146_2_Children[lM_24146_2_Children.Length - 1].mirror    = false;
            lM_24146_2_Children[lM_24146_2_Children.Length - 1].timeScale = 1.2f;
            lM_24146.children = lM_24146_2_Children;

            lM_24146.AddChild(m20106, new Vector2(-0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_24146_3_Children = lM_24146.children;
            lM_24146_3_Children[lM_24146_3_Children.Length - 1].mirror    = false;
            lM_24146_3_Children[lM_24146_3_Children.Length - 1].timeScale = 1.2f;
            lM_24146.children = lM_24146_3_Children;

            lM_24146.AddChild(m20108, new Vector2(0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_24146_4_Children = lM_24146.children;
            lM_24146_4_Children[lM_24146_4_Children.Length - 1].mirror    = false;
            lM_24146_4_Children[lM_24146_4_Children.Length - 1].timeScale = 1.2f;
            lM_24146.children = lM_24146_4_Children;

            lM_24146.AddChild(m21194, new Vector2(-0.35f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_5_Children = lM_24146.children;
            lM_24146_5_Children[lM_24146_5_Children.Length - 1].mirror    = false;
            lM_24146_5_Children[lM_24146_5_Children.Length - 1].timeScale = 1.1f;
            lM_24146.children = lM_24146_5_Children;

            lM_24146.AddChild(m21196, new Vector2(0.35f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_6_Children = lM_24146.children;
            lM_24146_6_Children[lM_24146_6_Children.Length - 1].mirror    = false;
            lM_24146_6_Children[lM_24146_6_Children.Length - 1].timeScale = 1.1f;
            lM_24146.children = lM_24146_6_Children;

            lM_24146.AddChild(m24326, new Vector2(0f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_24146_7_Children = lM_24146.children;
            lM_24146_7_Children[lM_24146_7_Children.Length - 1].mirror    = false;
            lM_24146_7_Children[lM_24146_7_Children.Length - 1].timeScale = 1f;
            lM_24146.children = lM_24146_7_Children;

            lM_24106.AddChild(lM_24146, 0.5f);

            UnityEditor.Animations.BlendTree lM_24116 = CreateBlendTree("RunTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_24116.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_24116.blendParameter  = "InputX";
            lM_24116.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_24116.useAutomaticThresholds = true;
#endif
            lM_24116.AddChild(m14502, new Vector2(0f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_0_Children = lM_24116.children;
            lM_24116_0_Children[lM_24116_0_Children.Length - 1].mirror    = false;
            lM_24116_0_Children[lM_24116_0_Children.Length - 1].timeScale = 1f;
            lM_24116.children = lM_24116_0_Children;

            lM_24116.AddChild(m22442, new Vector2(0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_1_Children = lM_24116.children;
            lM_24116_1_Children[lM_24116_1_Children.Length - 1].mirror    = false;
            lM_24116_1_Children[lM_24116_1_Children.Length - 1].timeScale = 1.1f;
            lM_24116.children = lM_24116_1_Children;

            lM_24116.AddChild(m22440, new Vector2(-0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_2_Children = lM_24116.children;
            lM_24116_2_Children[lM_24116_2_Children.Length - 1].mirror    = false;
            lM_24116_2_Children[lM_24116_2_Children.Length - 1].timeScale = 1.1f;
            lM_24116.children = lM_24116_2_Children;

            lM_24116.AddChild(m22444, new Vector2(-0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_24116_3_Children = lM_24116.children;
            lM_24116_3_Children[lM_24116_3_Children.Length - 1].mirror    = false;
            lM_24116_3_Children[lM_24116_3_Children.Length - 1].timeScale = 1f;
            lM_24116.children = lM_24116_3_Children;

            lM_24116.AddChild(m22446, new Vector2(0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_24116_4_Children = lM_24116.children;
            lM_24116_4_Children[lM_24116_4_Children.Length - 1].mirror    = false;
            lM_24116_4_Children[lM_24116_4_Children.Length - 1].timeScale = 1f;
            lM_24116.children = lM_24116_4_Children;

            lM_24116.AddChild(m22436, new Vector2(-0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_5_Children = lM_24116.children;
            lM_24116_5_Children[lM_24116_5_Children.Length - 1].mirror    = false;
            lM_24116_5_Children[lM_24116_5_Children.Length - 1].timeScale = 1.1f;
            lM_24116.children = lM_24116_5_Children;

            lM_24116.AddChild(m22438, new Vector2(0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_6_Children = lM_24116.children;
            lM_24116_6_Children[lM_24116_6_Children.Length - 1].mirror    = false;
            lM_24116_6_Children[lM_24116_6_Children.Length - 1].timeScale = 1.1f;
            lM_24116.children = lM_24116_6_Children;

            lM_24116.AddChild(m18780, new Vector2(0f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_24116_7_Children = lM_24116.children;
            lM_24116_7_Children[lM_24116_7_Children.Length - 1].mirror    = false;
            lM_24116_7_Children[lM_24116_7_Children.Length - 1].timeScale = 1f;
            lM_24116.children = lM_24116_7_Children;

            lM_24106.AddChild(lM_24116, 1f);
            lS_24896.motion = lM_24106;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_24700 = lRootStateMachine.AddAnyStateTransition(lS_24896);
            lT_24700.hasExitTime      = false;
            lT_24700.hasFixedDuration = true;
            lT_24700.exitTime         = 0.9f;
            lT_24700.duration         = 0.2f;
            lT_24700.offset           = 0f;
            lT_24700.mute             = false;
            lT_24700.solo             = false;
            lT_24700.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1130f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_25732 = lS_25730.AddTransition(lS_24896);
            lT_25732.hasExitTime         = false;
            lT_25732.hasFixedDuration    = true;
            lT_25732.exitTime            = 0f;
            lT_25732.duration            = 0.25f;
            lT_25732.offset              = 0f;
            lT_25732.mute                = false;
            lT_25732.solo                = false;
            lT_25732.canTransitionToSelf = true;
            lT_25732.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.1f, "InputMagnitude");

            UnityEditor.Animations.AnimatorStateTransition lT_25734 = lS_24896.AddTransition(lS_25730);
            lT_25734.hasExitTime         = false;
            lT_25734.hasFixedDuration    = true;
            lT_25734.exitTime            = 1f;
            lT_25734.duration            = 0.2f;
            lT_25734.offset              = 0f;
            lT_25734.mute                = false;
            lT_25734.solo                = false;
            lT_25734.canTransitionToSelf = true;
            lT_25734.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1135f, "L0MotionPhase");
            lT_25734.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");
        }
Beispiel #7
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_38592            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

            // If we find the sm with our name, remove it
            for (int i = 0; i < lRootStateMachine.stateMachines.Length; i++)
            {
                // Look for a sm with the matching name
                if (lRootStateMachine.stateMachines[i].stateMachine.name == _EditorAnimatorSMName)
                {
                    lRootSubStateMachine = lRootStateMachine.stateMachines[i].stateMachine;

                    // Allow the user to stop before we remove the sm
                    if (!UnityEditor.EditorUtility.DisplayDialog("Motion Controller", _EditorAnimatorSMName + " already exists. Delete and recreate it?", "Yes", "No"))
                    {
                        return;
                    }

                    // Remove the sm
                    //lRootStateMachine.RemoveStateMachine(lRootStateMachine.stateMachines[i].stateMachine);
                    break;
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lSM_N2165318 = lRootSubStateMachine;
            if (lSM_N2165318 != null)
            {
                for (int i = lSM_N2165318.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_N2165318.RemoveEntryTransition(lSM_N2165318.entryTransitions[i]);
                }

                for (int i = lSM_N2165318.anyStateTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_N2165318.RemoveAnyStateTransition(lSM_N2165318.anyStateTransitions[i]);
                }

                for (int i = lSM_N2165318.states.Length - 1; i >= 0; i--)
                {
                    lSM_N2165318.RemoveState(lSM_N2165318.states[i].state);
                }

                for (int i = lSM_N2165318.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_N2165318.RemoveStateMachine(lSM_N2165318.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_N2165318 = lSM_38592.AddStateMachine(_EditorAnimatorSMName, new Vector3(420, 324, 0));
            }

            UnityEditor.Animations.AnimatorState lS_N2165320 = lSM_N2165318.AddState("IdlePose Out", new Vector3(600, 120, 0));
            lS_N2165320.speed  = 1f;
            lS_N2165320.motion = m19780;

            UnityEditor.Animations.AnimatorState lS_N2165322 = lSM_N2165318.AddState("Move Tree", new Vector3(312, 120, 0));
            lS_N2165322.speed = 1f;

            UnityEditor.Animations.BlendTree lM_N2165324 = CreateBlendTree("Move Blend Tree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N2165324.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_N2165324.blendParameter  = "InputMagnitude";
            lM_N2165324.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N2165324.useAutomaticThresholds = true;
#endif
            lM_N2165324.AddChild(m19780, 0f);

            UnityEditor.Animations.BlendTree lM_N2165328 = CreateBlendTree("WalkTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N2165328.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_N2165328.blendParameter  = "InputX";
            lM_N2165328.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N2165328.useAutomaticThresholds = true;
#endif
            lM_N2165328.AddChild(m17768, new Vector2(0f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_N2165328_0_Children = lM_N2165328.children;
            lM_N2165328_0_Children[lM_N2165328_0_Children.Length - 1].mirror    = false;
            lM_N2165328_0_Children[lM_N2165328_0_Children.Length - 1].timeScale = 1f;
            lM_N2165328.children = lM_N2165328_0_Children;

            lM_N2165328.AddChild(m23934, new Vector2(-0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_N2165328_1_Children = lM_N2165328.children;
            lM_N2165328_1_Children[lM_N2165328_1_Children.Length - 1].mirror    = false;
            lM_N2165328_1_Children[lM_N2165328_1_Children.Length - 1].timeScale = 1f;
            lM_N2165328.children = lM_N2165328_1_Children;

            lM_N2165328.AddChild(m25304, new Vector2(0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_N2165328_2_Children = lM_N2165328.children;
            lM_N2165328_2_Children[lM_N2165328_2_Children.Length - 1].mirror    = false;
            lM_N2165328_2_Children[lM_N2165328_2_Children.Length - 1].timeScale = 1f;
            lM_N2165328.children = lM_N2165328_2_Children;

            lM_N2165328.AddChild(m15900, new Vector2(0f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_N2165328_3_Children = lM_N2165328.children;
            lM_N2165328_3_Children[lM_N2165328_3_Children.Length - 1].mirror    = false;
            lM_N2165328_3_Children[lM_N2165328_3_Children.Length - 1].timeScale = 1f;
            lM_N2165328.children = lM_N2165328_3_Children;

            lM_N2165324.AddChild(lM_N2165328, 0.5f);

            UnityEditor.Animations.BlendTree lM_N2165332 = CreateBlendTree("RunTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N2165332.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_N2165332.blendParameter  = "InputX";
            lM_N2165332.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N2165332.useAutomaticThresholds = true;
#endif
            lM_N2165332.AddChild(m16640, new Vector2(0f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_N2165332_0_Children = lM_N2165332.children;
            lM_N2165332_0_Children[lM_N2165332_0_Children.Length - 1].mirror    = false;
            lM_N2165332_0_Children[lM_N2165332_0_Children.Length - 1].timeScale = 1f;
            lM_N2165332.children = lM_N2165332_0_Children;

            lM_N2165332.AddChild(m15614, new Vector2(-0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_N2165332_1_Children = lM_N2165332.children;
            lM_N2165332_1_Children[lM_N2165332_1_Children.Length - 1].mirror    = false;
            lM_N2165332_1_Children[lM_N2165332_1_Children.Length - 1].timeScale = 1f;
            lM_N2165332.children = lM_N2165332_1_Children;

            lM_N2165332.AddChild(m24920, new Vector2(0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_N2165332_2_Children = lM_N2165332.children;
            lM_N2165332_2_Children[lM_N2165332_2_Children.Length - 1].mirror    = false;
            lM_N2165332_2_Children[lM_N2165332_2_Children.Length - 1].timeScale = 1f;
            lM_N2165332.children = lM_N2165332_2_Children;

            lM_N2165332.AddChild(m16328, new Vector2(0f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_N2165332_3_Children = lM_N2165332.children;
            lM_N2165332_3_Children[lM_N2165332_3_Children.Length - 1].mirror    = false;
            lM_N2165332_3_Children[lM_N2165332_3_Children.Length - 1].timeScale = 1f;
            lM_N2165332.children = lM_N2165332_3_Children;

            lM_N2165324.AddChild(lM_N2165332, 1f);
            lS_N2165322.motion = lM_N2165324;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_N2165336 = lRootStateMachine.AddAnyStateTransition(lS_N2165322);
            lT_N2165336.hasExitTime         = false;
            lT_N2165336.hasFixedDuration    = true;
            lT_N2165336.exitTime            = 0.9f;
            lT_N2165336.duration            = 0.4f;
            lT_N2165336.offset              = 0f;
            lT_N2165336.mute                = false;
            lT_N2165336.solo                = false;
            lT_N2165336.canTransitionToSelf = true;
            lT_N2165336.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_N2165336.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 32210f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_N2165338 = lS_N2165320.AddTransition(lS_N2165322);
            lT_N2165338.hasExitTime         = false;
            lT_N2165338.hasFixedDuration    = true;
            lT_N2165338.exitTime            = 0f;
            lT_N2165338.duration            = 0.25f;
            lT_N2165338.offset              = 0f;
            lT_N2165338.mute                = false;
            lT_N2165338.solo                = false;
            lT_N2165338.canTransitionToSelf = true;
            lT_N2165338.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_N2165338.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.1f, "InputMagnitude");

            UnityEditor.Animations.AnimatorStateTransition lT_N2165340 = lS_N2165322.AddTransition(lS_N2165320);
            lT_N2165340.hasExitTime         = false;
            lT_N2165340.hasFixedDuration    = true;
            lT_N2165340.exitTime            = 1f;
            lT_N2165340.duration            = 0.25f;
            lT_N2165340.offset              = 0f;
            lT_N2165340.mute                = false;
            lT_N2165340.solo                = false;
            lT_N2165340.canTransitionToSelf = true;
            lT_N2165340.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_N2165340.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 32215f, "L0MotionPhase");
            lT_N2165340.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");
        }
Beispiel #8
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_23510            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

            // If we find the sm with our name, remove it
            for (int i = 0; i < lRootStateMachine.stateMachines.Length; i++)
            {
                // Look for a sm with the matching name
                if (lRootStateMachine.stateMachines[i].stateMachine.name == _EditorAnimatorSMName)
                {
                    lRootSubStateMachine = lRootStateMachine.stateMachines[i].stateMachine;

                    // Allow the user to stop before we remove the sm
                    if (!UnityEditor.EditorUtility.DisplayDialog("Motion Controller", _EditorAnimatorSMName + " already exists. Delete and recreate it?", "Yes", "No"))
                    {
                        return;
                    }

                    // Remove the sm
                    //lRootStateMachine.RemoveStateMachine(lRootStateMachine.stateMachines[i].stateMachine);
                    break;
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lSM_23512 = lRootSubStateMachine;
            if (lSM_23512 != null)
            {
                for (int i = lSM_23512.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_23512.RemoveEntryTransition(lSM_23512.entryTransitions[i]);
                }

                for (int i = lSM_23512.anyStateTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_23512.RemoveAnyStateTransition(lSM_23512.anyStateTransitions[i]);
                }

                for (int i = lSM_23512.states.Length - 1; i >= 0; i--)
                {
                    lSM_23512.RemoveState(lSM_23512.states[i].state);
                }

                for (int i = lSM_23512.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_23512.RemoveStateMachine(lSM_23512.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_23512 = lSM_23510.AddStateMachine(_EditorAnimatorSMName, new Vector3(408, -84, 0));
            }

            UnityEditor.Animations.AnimatorState lS_N18490 = lSM_23512.AddState("TreadIdlePose", new Vector3(600, 72, 0));
            lS_N18490.speed  = 1f;
            lS_N18490.motion = m15640;

            UnityEditor.Animations.AnimatorState lS_N18492 = lSM_23512.AddState("Swim Tree", new Vector3(312, 120, 0));
            lS_N18492.speed = 1f;

            UnityEditor.Animations.BlendTree lM_N18494 = CreateBlendTree("Swim Blend Tree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N18494.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_N18494.blendParameter  = "InputMagnitude";
            lM_N18494.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N18494.useAutomaticThresholds = false;
#endif
            lM_N18494.AddChild(m15642, 0f);

            UnityEditor.Animations.BlendTree lM_N18498 = CreateBlendTree("TreadTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N18498.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_N18498.blendParameter  = "InputX";
            lM_N18498.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N18498.useAutomaticThresholds = true;
#endif
            lM_N18498.AddChild(m15642, new Vector2(0f, 0.1f));
            lM_N18498.AddChild(m15642, new Vector2(-0.1f, 0f));
            lM_N18498.AddChild(m15642, new Vector2(0.1f, 0f));
            lM_N18498.AddChild(m15642, new Vector2(0f, -0.1f));
            lM_N18494.AddChild(lM_N18498, 0.5f);

            UnityEditor.Animations.BlendTree lM_N18502 = CreateBlendTree("SwimTree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_N18502.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_N18502.blendParameter  = "InputX";
            lM_N18502.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_N18502.useAutomaticThresholds = true;
#endif
            lM_N18502.AddChild(m17384, new Vector2(0f, 0.1f));
            lM_N18502.AddChild(m17382, new Vector2(-0.1f, 0f));
            lM_N18502.AddChild(m17386, new Vector2(0.1f, 0f));
            lM_N18502.AddChild(m15642, new Vector2(0f, -0.1f));
            lM_N18494.AddChild(lM_N18502, 1f);
            lS_N18492.motion = lM_N18494;

            UnityEditor.Animations.AnimatorState lS_N18506 = lSM_23512.AddState("IdlePose", new Vector3(600, 156, 0));
            lS_N18506.speed  = 1f;
            lS_N18506.motion = m14222;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_N18508 = lRootStateMachine.AddAnyStateTransition(lS_N18492);
            lT_N18508.hasExitTime      = false;
            lT_N18508.hasFixedDuration = true;
            lT_N18508.exitTime         = 0.9f;
            lT_N18508.duration         = 0.4f;
            lT_N18508.offset           = 0f;
            lT_N18508.mute             = false;
            lT_N18508.solo             = false;
            lT_N18508.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 31400f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_N18510 = lS_N18490.AddTransition(lS_N18492);
            lT_N18510.hasExitTime         = false;
            lT_N18510.hasFixedDuration    = true;
            lT_N18510.exitTime            = 0f;
            lT_N18510.duration            = 0.2f;
            lT_N18510.offset              = 0f;
            lT_N18510.mute                = false;
            lT_N18510.solo                = false;
            lT_N18510.canTransitionToSelf = true;
            lT_N18510.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.1f, "InputMagnitude");

            UnityEditor.Animations.AnimatorStateTransition lT_N18512 = lS_N18492.AddTransition(lS_N18490);
            lT_N18512.hasExitTime         = false;
            lT_N18512.hasFixedDuration    = true;
            lT_N18512.exitTime            = 1f;
            lT_N18512.duration            = 0.3f;
            lT_N18512.offset              = 0f;
            lT_N18512.mute                = false;
            lT_N18512.solo                = false;
            lT_N18512.canTransitionToSelf = true;
            lT_N18512.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 31405f, "L0MotionPhase");
            lT_N18512.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");

            UnityEditor.Animations.AnimatorStateTransition lT_N18514 = lS_N18492.AddTransition(lS_N18506);
            lT_N18514.hasExitTime         = false;
            lT_N18514.hasFixedDuration    = true;
            lT_N18514.exitTime            = 0.9286847f;
            lT_N18514.duration            = 0.25f;
            lT_N18514.offset              = 0f;
            lT_N18514.mute                = false;
            lT_N18514.solo                = false;
            lT_N18514.canTransitionToSelf = true;
            lT_N18514.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 31406f, "L0MotionPhase");
        }
Beispiel #9
0
        /// <summary>
        /// New way to create sub-state machines without destroying what exists first.
        /// </summary>
        protected override void CreateStateMachine()
        {
            int rLayerIndex = mMotionLayer._AnimatorLayerIndex;
            MotionController rMotionController = mMotionController;

            UnityEditor.Animations.AnimatorController lController = null;

            Animator lAnimator = rMotionController.Animator;

            if (lAnimator == null)
            {
                lAnimator = rMotionController.gameObject.GetComponent <Animator>();
            }
            if (lAnimator != null)
            {
                lController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
            }
            if (lController == null)
            {
                return;
            }

            while (lController.layers.Length <= rLayerIndex)
            {
                UnityEditor.Animations.AnimatorControllerLayer lNewLayer = new UnityEditor.Animations.AnimatorControllerLayer();
                lNewLayer.name         = "Layer " + (lController.layers.Length + 1);
                lNewLayer.stateMachine = new UnityEditor.Animations.AnimatorStateMachine();
                lController.AddLayer(lNewLayer);
            }

            UnityEditor.Animations.AnimatorControllerLayer lLayer = lController.layers[rLayerIndex];

            UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine;

            UnityEditor.Animations.AnimatorStateMachine lSSM_37926 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicWalkRunStrafe-SM");
            if (lSSM_37926 == null)
            {
                lSSM_37926 = lLayerStateMachine.AddStateMachine("BasicWalkRunStrafe-SM", new Vector3(408, -1008, 0));
            }

            UnityEditor.Animations.AnimatorState lState_38402 = MotionControllerMotion.EditorFindState(lSSM_37926, "Unarmed BlendTree");
            if (lState_38402 == null)
            {
                lState_38402 = lSSM_37926.AddState("Unarmed BlendTree", new Vector3(336, 24, 0));
            }
            lState_38402.speed  = 1f;
            lState_38402.mirror = false;
            lState_38402.tag    = "";

            UnityEditor.Animations.BlendTree lM_25600 = MotionControllerMotion.EditorCreateBlendTree("Move Blend Tree", lController, rLayerIndex);
            lM_25600.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_25600.blendParameter  = "InputMagnitude";
            lM_25600.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_25600.useAutomaticThresholds = false;
#endif
            lM_25600.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Idling/unity_Idle_IdleToIdlesR.fbx", "IdlePose"), 0f);

            UnityEditor.Animations.BlendTree lM_25694 = MotionControllerMotion.EditorCreateBlendTree("WalkTree", lController, rLayerIndex);
            lM_25694.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_25694.blendParameter  = "InputX";
            lM_25694.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_25694.useAutomaticThresholds = true;
#endif
            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_WalkFWD_v2.fbx", "WalkForward"), new Vector2(0f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_0_Children = lM_25694.children;
            lM_25694_0_Children[lM_25694_0_Children.Length - 1].mirror    = false;
            lM_25694_0_Children[lM_25694_0_Children.Length - 1].timeScale = 1.1f;
            lM_25694.children = lM_25694_0_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_SWalk_v2.fbx", "SWalkForwardRight"), new Vector2(0.35f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_1_Children = lM_25694.children;
            lM_25694_1_Children[lM_25694_1_Children.Length - 1].mirror    = false;
            lM_25694_1_Children[lM_25694_1_Children.Length - 1].timeScale = 1.2f;
            lM_25694.children = lM_25694_1_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_SWalk_v2.fbx", "SWalkForwardLeft"), new Vector2(-0.35f, 0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_2_Children = lM_25694.children;
            lM_25694_2_Children[lM_25694_2_Children.Length - 1].mirror    = false;
            lM_25694_2_Children[lM_25694_2_Children.Length - 1].timeScale = 1.2f;
            lM_25694.children = lM_25694_2_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_SWalk_v2.fbx", "SWalkLeft"), new Vector2(-0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_25694_3_Children = lM_25694.children;
            lM_25694_3_Children[lM_25694_3_Children.Length - 1].mirror    = false;
            lM_25694_3_Children[lM_25694_3_Children.Length - 1].timeScale = 1.2f;
            lM_25694.children = lM_25694_3_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_SWalk_v2.fbx", "SWalkRight"), new Vector2(0.35f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_25694_4_Children = lM_25694.children;
            lM_25694_4_Children[lM_25694_4_Children.Length - 1].mirror    = false;
            lM_25694_4_Children[lM_25694_4_Children.Length - 1].timeScale = 1.2f;
            lM_25694.children = lM_25694_4_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_Idle2Strafe_AllAngles.fbx", "WalkStrafeBackwardsLeft"), new Vector2(-0.35f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_5_Children = lM_25694.children;
            lM_25694_5_Children[lM_25694_5_Children.Length - 1].mirror    = false;
            lM_25694_5_Children[lM_25694_5_Children.Length - 1].timeScale = 1.1f;
            lM_25694.children = lM_25694_5_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_Idle2Strafe_AllAngles.fbx", "WalkStrafeBackwardsRight"), new Vector2(0.35f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_6_Children = lM_25694.children;
            lM_25694_6_Children[lM_25694_6_Children.Length - 1].mirror    = false;
            lM_25694_6_Children[lM_25694_6_Children.Length - 1].timeScale = 1.1f;
            lM_25694.children = lM_25694_6_Children;

            lM_25694.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Walking/unity_BWalk.fbx", "WalkBackwards"), new Vector2(0f, -0.35f));
            UnityEditor.Animations.ChildMotion[] lM_25694_7_Children = lM_25694.children;
            lM_25694_7_Children[lM_25694_7_Children.Length - 1].mirror    = false;
            lM_25694_7_Children[lM_25694_7_Children.Length - 1].timeScale = 1f;
            lM_25694.children = lM_25694_7_Children;

            lM_25600.AddChild(lM_25694, 0.5f);

            UnityEditor.Animations.BlendTree lM_25630 = MotionControllerMotion.EditorCreateBlendTree("RunTree", lController, rLayerIndex);
            lM_25630.blendType       = UnityEditor.Animations.BlendTreeType.SimpleDirectional2D;
            lM_25630.blendParameter  = "InputX";
            lM_25630.blendParameterY = "InputY";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_25630.useAutomaticThresholds = true;
#endif
            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunForward_v2.fbx", "RunForward"), new Vector2(0f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_0_Children = lM_25630.children;
            lM_25630_0_Children[lM_25630_0_Children.Length - 1].mirror    = false;
            lM_25630_0_Children[lM_25630_0_Children.Length - 1].timeScale = 1f;
            lM_25630.children = lM_25630_0_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeForwardRight"), new Vector2(0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_1_Children = lM_25630.children;
            lM_25630_1_Children[lM_25630_1_Children.Length - 1].mirror    = false;
            lM_25630_1_Children[lM_25630_1_Children.Length - 1].timeScale = 1.1f;
            lM_25630.children = lM_25630_1_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeForwardLeft"), new Vector2(-0.7f, 0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_2_Children = lM_25630.children;
            lM_25630_2_Children[lM_25630_2_Children.Length - 1].mirror    = false;
            lM_25630_2_Children[lM_25630_2_Children.Length - 1].timeScale = 1.1f;
            lM_25630.children = lM_25630_2_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeLeft"), new Vector2(-0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_25630_3_Children = lM_25630.children;
            lM_25630_3_Children[lM_25630_3_Children.Length - 1].mirror    = false;
            lM_25630_3_Children[lM_25630_3_Children.Length - 1].timeScale = 1f;
            lM_25630.children = lM_25630_3_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeRight"), new Vector2(0.7f, 0f));
            UnityEditor.Animations.ChildMotion[] lM_25630_4_Children = lM_25630.children;
            lM_25630_4_Children[lM_25630_4_Children.Length - 1].mirror    = false;
            lM_25630_4_Children[lM_25630_4_Children.Length - 1].timeScale = 1f;
            lM_25630.children = lM_25630_4_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeBackwardLeft"), new Vector2(-0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_5_Children = lM_25630.children;
            lM_25630_5_Children[lM_25630_5_Children.Length - 1].mirror    = false;
            lM_25630_5_Children[lM_25630_5_Children.Length - 1].timeScale = 1.1f;
            lM_25630.children = lM_25630_5_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunStrafe.fbx", "RunStrafeBackwardRight"), new Vector2(0.7f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_6_Children = lM_25630.children;
            lM_25630_6_Children[lM_25630_6_Children.Length - 1].mirror    = false;
            lM_25630_6_Children[lM_25630_6_Children.Length - 1].timeScale = 1.1f;
            lM_25630.children = lM_25630_6_Children;

            lM_25630.AddChild(MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Running/RunBackward.fbx", "RunBackwards"), new Vector2(0f, -0.7f));
            UnityEditor.Animations.ChildMotion[] lM_25630_7_Children = lM_25630.children;
            lM_25630_7_Children[lM_25630_7_Children.Length - 1].mirror    = false;
            lM_25630_7_Children[lM_25630_7_Children.Length - 1].timeScale = 1f;
            lM_25630.children = lM_25630_7_Children;

            lM_25600.AddChild(lM_25630, 1f);
            lState_38402.motion = lM_25600;

            UnityEditor.Animations.AnimatorStateTransition lAnyTransition_38112 = MotionControllerMotion.EditorFindAnyStateTransition(lLayerStateMachine, lState_38402, 0);
            if (lAnyTransition_38112 == null)
            {
                lAnyTransition_38112 = lLayerStateMachine.AddAnyStateTransition(lState_38402);
            }
            lAnyTransition_38112.isExit              = false;
            lAnyTransition_38112.hasExitTime         = false;
            lAnyTransition_38112.hasFixedDuration    = true;
            lAnyTransition_38112.exitTime            = 0.9f;
            lAnyTransition_38112.duration            = 0.2f;
            lAnyTransition_38112.offset              = 0f;
            lAnyTransition_38112.mute                = false;
            lAnyTransition_38112.solo                = false;
            lAnyTransition_38112.canTransitionToSelf = true;
            lAnyTransition_38112.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lAnyTransition_38112.conditions.Length - 1; i >= 0; i--)
            {
                lAnyTransition_38112.RemoveCondition(lAnyTransition_38112.conditions[i]);
            }
            lAnyTransition_38112.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 3100f, "L" + rLayerIndex + "MotionPhase");
            lAnyTransition_38112.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L" + rLayerIndex + "MotionForm");

#if USE_ARCHERY_MP || OOTII_AYMP
            ArcheryPackDefinition.ExtendBasicWalkRunStrafe(rMotionController, rLayerIndex);
#endif

#if USE_SWORD_SHIELD_MP || OOTII_SSMP
            SwordShieldPackDefinition.ExtendBasicWalkRunStrafe(rMotionController, rLayerIndex);
#endif

#if USE_SPELL_CASTING_MP || OOTII_SCMP
            SpellCastingPackDefinition.ExtendBasicWalkRunStrafe(rMotionController, rLayerIndex);
#endif

#if USE_SHOOTER_MP || OOTII_SHMP
            ShooterPackDefinition.ExtendBasicWalkRunStrafe(rMotionController, rLayerIndex);
#endif

            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #10
0
 public AnimatorState CreateBlendTreeInController(string name, out UnityEditor.Animations.BlendTree tree)
 {
     return(this.CreateBlendTreeInController(name, out tree, 0));
 }
Beispiel #11
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_38592            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

            // If we find the sm with our name, remove it
            for (int i = 0; i < lRootStateMachine.stateMachines.Length; i++)
            {
                // Look for a sm with the matching name
                if (lRootStateMachine.stateMachines[i].stateMachine.name == _EditorAnimatorSMName)
                {
                    lRootSubStateMachine = lRootStateMachine.stateMachines[i].stateMachine;

                    // Allow the user to stop before we remove the sm
                    if (!UnityEditor.EditorUtility.DisplayDialog("Motion Controller", _EditorAnimatorSMName + " already exists. Delete and recreate it?", "Yes", "No"))
                    {
                        return;
                    }

                    // Remove the sm
                    //lRootStateMachine.RemoveStateMachine(lRootStateMachine.stateMachines[i].stateMachine);
                    break;
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lSM_38604 = lRootSubStateMachine;
            if (lSM_38604 != null)
            {
                for (int i = lSM_38604.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_38604.RemoveEntryTransition(lSM_38604.entryTransitions[i]);
                }

                for (int i = lSM_38604.anyStateTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_38604.RemoveAnyStateTransition(lSM_38604.anyStateTransitions[i]);
                }

                for (int i = lSM_38604.states.Length - 1; i >= 0; i--)
                {
                    lSM_38604.RemoveState(lSM_38604.states[i].state);
                }

                for (int i = lSM_38604.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_38604.RemoveStateMachine(lSM_38604.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_38604 = lSM_38592.AddStateMachine(_EditorAnimatorSMName, new Vector3(624, 264, 0));
            }

            UnityEditor.Animations.AnimatorState lS_38960 = lSM_38604.AddState("Move Tree", new Vector3(192, 216, 0));
            lS_38960.speed = 1f;

            UnityEditor.Animations.BlendTree lM_14838 = CreateBlendTree("Move Blend Tree", _EditorAnimatorController, mMotionLayer.AnimatorLayerIndex);
            lM_14838.blendType       = UnityEditor.Animations.BlendTreeType.Simple1D;
            lM_14838.blendParameter  = "InputMagnitude";
            lM_14838.blendParameterY = "InputX";
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3)
            lM_14838.useAutomaticThresholds = false;
#endif
            lM_14838.AddChild(m17768, 0f);
            lM_14838.AddChild(m17768, 0.5f);
            lM_14838.AddChild(m16640, 1f);
            lS_38960.motion = lM_14838;

            UnityEditor.Animations.AnimatorState lS_39156 = lSM_38604.AddState("IdlePose", new Vector3(492, 216, 0));
            lS_39156.speed  = 1f;
            lS_39156.motion = m19780;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_38780 = lRootStateMachine.AddAnyStateTransition(lS_38960);
            lT_38780.hasExitTime         = false;
            lT_38780.hasFixedDuration    = true;
            lT_38780.exitTime            = 0.9f;
            lT_38780.duration            = 0.2f;
            lT_38780.offset              = 0f;
            lT_38780.mute                = false;
            lT_38780.solo                = false;
            lT_38780.canTransitionToSelf = false;
            lT_38780.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_38780.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 32200f, "L0MotionPhase");
            lT_38780.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");

            UnityEditor.Animations.AnimatorStateTransition lT_39166 = lS_38960.AddTransition(lS_39156);
            lT_39166.hasExitTime         = false;
            lT_39166.hasFixedDuration    = true;
            lT_39166.exitTime            = 0.7383721f;
            lT_39166.duration            = 0.15f;
            lT_39166.offset              = 0f;
            lT_39166.mute                = false;
            lT_39166.solo                = false;
            lT_39166.canTransitionToSelf = true;
            lT_39166.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_39166.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 32201f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_39190 = lS_39156.AddTransition(lS_38960);
            lT_39190.hasExitTime         = false;
            lT_39190.hasFixedDuration    = true;
            lT_39190.exitTime            = 0f;
            lT_39190.duration            = 0.1f;
            lT_39190.offset              = 0f;
            lT_39190.mute                = false;
            lT_39190.solo                = false;
            lT_39190.canTransitionToSelf = true;
            lT_39190.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_39190.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.2f, "InputMagnitude");
        }