Beispiel #1
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 #2
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_23030            = _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_24308 = lRootSubStateMachine;
            if (lSM_24308 != null)
            {
                for (int i = lSM_24308.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_24308.RemoveEntryTransition(lSM_24308.entryTransitions[i]);
                }

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

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

                for (int i = lSM_24308.stateMachines.Length - 1; i >= 0; i--)
                {
                    lSM_24308.RemoveStateMachine(lSM_24308.stateMachines[i].stateMachine);
                }
            }
            else
            {
                lSM_24308 = lSM_23030.AddStateMachine(_EditorAnimatorSMName, new Vector3(48, 12, 0));
            }

            UnityEditor.Animations.AnimatorState lS_24312 = lSM_24308.AddState("Punch", new Vector3(276, 12, 0));
            lS_24312.speed  = 1f;
            lS_24312.motion = m17128;

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

            UnityEditor.Animations.AnimatorStateTransition lT_24314 = lS_24312.AddTransition(lRootStateMachine);
            lT_24314.hasExitTime         = true;
            lT_24314.hasFixedDuration    = true;
            lT_24314.exitTime            = 0.8f;
            lT_24314.duration            = 0.2f;
            lT_24314.offset              = 0f;
            lT_24314.mute                = false;
            lT_24314.solo                = false;
            lT_24314.canTransitionToSelf = true;
            lT_24314.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
        }
Beispiel #3
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");
        }
        /// <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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lIdlePose = lMotionStateMachine.AddState("IdlePose", new Vector3(840, 204, 0));
            lIdlePose.motion = mIdlePose;
            lIdlePose.speed  = 1f;

            UnityEditor.Animations.AnimatorState lRunJump_RunForward = lMotionStateMachine.AddState("RunJump_RunForward", new Vector3(588, 288, 0));
            lRunJump_RunForward.motion = mRunForward;
            lRunJump_RunForward.speed  = 1f;

            UnityEditor.Animations.AnimatorState lRunningJump = lMotionStateMachine.AddState("RunningJump", new Vector3(324, 204, 0));
            lRunningJump.motion = mRunningJump;
            lRunningJump.speed  = 1f;

            UnityEditor.Animations.AnimatorState lLandToIdle = lMotionStateMachine.AddState("LandToIdle", new Vector3(588, 204, 0));
            lLandToIdle.motion = mLandToIdle;
            lLandToIdle.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lRunningJump.AddTransition(lRunJump_RunForward);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.8280886f;
            lStateTransition.duration         = 0.2499999f;
            lStateTransition.offset           = 0.2955611f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 27545f, "L0MotionPhase");

            lStateTransition                  = lRunningJump.AddTransition(lLandToIdle);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.8032071f;
            lStateTransition.duration         = 0.1951104f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 27540f, "L0MotionPhase");

            lStateTransition                  = lLandToIdle.AddTransition(lIdlePose);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.6590909f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
        }
Beispiel #5
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 #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_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_23572 = lRootSubStateMachine;
            if (lSM_23572 != null)
            {
                for (int i = lSM_23572.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_23572.RemoveEntryTransition(lSM_23572.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_24640 = lSM_23572.AddState("IdlePose", new Vector3(564, -12, 0));
            lS_24640.speed  = 1f;
            lS_24640.motion = m14222;

            UnityEditor.Animations.AnimatorState lS_23796 = lSM_23572.AddState("SwimEdgeExit", new Vector3(216, -12, 0));
            lS_23796.speed  = 1f;
            lS_23796.motion = m10496;

            UnityEditor.Animations.AnimatorState lS_24642 = lSM_23572.AddState("crouched_to_standing", new Vector3(564, 60, 0));
            lS_24642.speed  = 0.75f;
            lS_24642.motion = m17174;

            UnityEditor.Animations.AnimatorState lS_24644 = lSM_23572.AddState("braced_hang_to_crouch", new Vector3(300, 60, 0));
            lS_24644.speed  = 0.75f;
            lS_24644.motion = m19706;

            UnityEditor.Animations.AnimatorState lS_23798 = lSM_23572.AddState("TreadIdlePose", new Vector3(216, 144, 0));
            lS_23798.speed  = 1f;
            lS_23798.motion = m15640;

            UnityEditor.Animations.AnimatorState lS_23800 = lSM_23572.AddState("TreadIdleExitPose", new Vector3(216, 204, 0));
            lS_23800.speed  = 1f;
            lS_23800.motion = m15640;

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

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

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

            UnityEditor.Animations.AnimatorStateTransition lT_24646 = lS_23796.AddTransition(lS_24644);
            lT_24646.hasExitTime         = true;
            lT_24646.hasFixedDuration    = true;
            lT_24646.exitTime            = 0.3347696f;
            lT_24646.duration            = 0.4852898f;
            lT_24646.offset              = 0f;
            lT_24646.mute                = false;
            lT_24646.solo                = false;
            lT_24646.canTransitionToSelf = true;

            UnityEditor.Animations.AnimatorStateTransition lT_24648 = lS_24642.AddTransition(lS_24640);
            lT_24648.hasExitTime         = true;
            lT_24648.hasFixedDuration    = true;
            lT_24648.exitTime            = 0.7064211f;
            lT_24648.duration            = 0.25f;
            lT_24648.offset              = 0f;
            lT_24648.mute                = false;
            lT_24648.solo                = false;
            lT_24648.canTransitionToSelf = true;

            UnityEditor.Animations.AnimatorStateTransition lT_24650 = lS_24644.AddTransition(lS_24642);
            lT_24650.hasExitTime         = true;
            lT_24650.hasFixedDuration    = true;
            lT_24650.exitTime            = 0.9f;
            lT_24650.duration            = 0.1f;
            lT_24650.offset              = 0f;
            lT_24650.mute                = false;
            lT_24650.solo                = false;
            lT_24650.canTransitionToSelf = true;

            UnityEditor.Animations.AnimatorStateTransition lT_24652 = lS_23798.AddTransition(lS_24644);
            lT_24652.hasExitTime         = true;
            lT_24652.hasFixedDuration    = true;
            lT_24652.exitTime            = 0f;
            lT_24652.duration            = 0.25f;
            lT_24652.offset              = 0f;
            lT_24652.mute                = false;
            lT_24652.solo                = false;
            lT_24652.canTransitionToSelf = true;
        }
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_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_N25356 = lRootSubStateMachine;
            if (lSM_N25356 != null)
            {
                for (int i = lSM_N25356.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_N25356.RemoveEntryTransition(lSM_N25356.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_N25358 = lSM_N25356.AddState("run_to_dive", new Vector3(312, 132, 0));
            lS_N25358.speed  = 1f;
            lS_N25358.motion = m13726;

            UnityEditor.Animations.AnimatorState lS_N25360 = lSM_N25356.AddState("SwimIdlePose", new Vector3(576, 180, 0));
            lS_N25360.speed  = 1f;
            lS_N25360.motion = m17380;

            UnityEditor.Animations.AnimatorState lS_N25362 = lSM_N25356.AddState("StandingDive", new Vector3(312, 36, 0));
            lS_N25362.speed  = 1f;
            lS_N25362.motion = m18078;

            UnityEditor.Animations.AnimatorState lS_N25364 = lSM_N25356.AddState("TreadIdlePose", new Vector3(576, 96, 0));
            lS_N25364.speed  = 1f;
            lS_N25364.motion = m15640;

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

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

            UnityEditor.Animations.AnimatorStateTransition lT_N25370 = lS_N25358.AddTransition(lS_N25360);
            lT_N25370.hasExitTime         = false;
            lT_N25370.hasFixedDuration    = true;
            lT_N25370.exitTime            = 0.8834254f;
            lT_N25370.duration            = 0.25f;
            lT_N25370.offset              = 0f;
            lT_N25370.mute                = false;
            lT_N25370.solo                = false;
            lT_N25370.canTransitionToSelf = true;
            lT_N25370.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 31501f, "L0MotionPhase");
            lT_N25370.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.6f, "InputMagnitude");

            UnityEditor.Animations.AnimatorStateTransition lT_N25372 = lS_N25358.AddTransition(lS_N25364);
            lT_N25372.hasExitTime         = false;
            lT_N25372.hasFixedDuration    = true;
            lT_N25372.exitTime            = 0.7887324f;
            lT_N25372.duration            = 0.5f;
            lT_N25372.offset              = 0f;
            lT_N25372.mute                = false;
            lT_N25372.solo                = false;
            lT_N25372.canTransitionToSelf = true;
            lT_N25372.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 31501f, "L0MotionPhase");
            lT_N25372.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Less, 0.6f, "InputMagnitude");

            UnityEditor.Animations.AnimatorStateTransition lT_N25374 = lS_N25362.AddTransition(lS_N25358);
            lT_N25374.hasExitTime         = true;
            lT_N25374.hasFixedDuration    = true;
            lT_N25374.exitTime            = 0.6953372f;
            lT_N25374.duration            = 0.1499999f;
            lT_N25374.offset              = 0.3380885f;
            lT_N25374.mute                = false;
            lT_N25374.solo                = false;
            lT_N25374.canTransitionToSelf = true;
        }
Beispiel #8
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_N1556694 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicInteraction-SM");
            if (lSSM_N1556694 == null)
            {
                lSSM_N1556694 = lLayerStateMachine.AddStateMachine("BasicInteraction-SM", new Vector3(408, -960, 0));
            }

            UnityEditor.Animations.AnimatorState lState_N1565974 = MotionControllerMotion.EditorFindState(lSSM_N1556694, "Idle_GrabHighFront");
            if (lState_N1565974 == null)
            {
                lState_N1565974 = lSSM_N1556694.AddState("Idle_GrabHighFront", new Vector3(337, 54, 0));
            }
            lState_N1565974.speed  = 1.5f;
            lState_N1565974.mirror = false;
            lState_N1565974.tag    = "";
            lState_N1565974.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Interacting/Unity_IdleGrab_FrontHigh.fbx", "Idle_GrabHighFront");

            UnityEditor.Animations.AnimatorState lState_N1566382 = MotionControllerMotion.EditorFindState(lSSM_N1556694, "Idle_PickUp");
            if (lState_N1566382 == null)
            {
                lState_N1566382 = lSSM_N1556694.AddState("Idle_PickUp", new Vector3(336, 168, 0));
            }
            lState_N1566382.speed  = 1.5f;
            lState_N1566382.mirror = false;
            lState_N1566382.tag    = "";
            lState_N1566382.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Interacting/unity_IdleGrab_LowFront.fbx", "Idle_PickUp");

            UnityEditor.Animations.AnimatorState lState_N1567060 = MotionControllerMotion.EditorFindState(lSSM_N1556694, "Idle_PushButton");
            if (lState_N1567060 == null)
            {
                lState_N1567060 = lSSM_N1556694.AddState("Idle_PushButton", new Vector3(336, -48, 0));
            }
            lState_N1567060.speed  = 1.5f;
            lState_N1567060.mirror = false;
            lState_N1567060.tag    = "";
            lState_N1567060.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Interacting/unity_IdleGrab_Neutral.fbx", "Idle_PushButton");

            UnityEditor.Animations.AnimatorState lState_N1568354 = MotionControllerMotion.EditorFindState(lSSM_N1556694, "IdlePose");
            if (lState_N1568354 == null)
            {
                lState_N1568354 = lSSM_N1556694.AddState("IdlePose", new Vector3(600, 48, 0));
            }
            lState_N1568354.speed  = 1f;
            lState_N1568354.mirror = false;
            lState_N1568354.tag    = "Exit";
            lState_N1568354.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/MotionController/Content/Animations/Humanoid/Idling/unity_Idle_IdleToIdlesR.fbx", "IdlePose");

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

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

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

            UnityEditor.Animations.AnimatorStateTransition lTransition_N1569370 = MotionControllerMotion.EditorFindTransition(lState_N1565974, lState_N1568354, 0);
            if (lTransition_N1569370 == null)
            {
                lTransition_N1569370 = lState_N1565974.AddTransition(lState_N1568354);
            }
            lTransition_N1569370.isExit              = false;
            lTransition_N1569370.hasExitTime         = true;
            lTransition_N1569370.hasFixedDuration    = true;
            lTransition_N1569370.exitTime            = 0.9285715f;
            lTransition_N1569370.duration            = 0.25f;
            lTransition_N1569370.offset              = 0f;
            lTransition_N1569370.mute                = false;
            lTransition_N1569370.solo                = false;
            lTransition_N1569370.canTransitionToSelf = true;
            lTransition_N1569370.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lTransition_N1569370.conditions.Length - 1; i >= 0; i--)
            {
                lTransition_N1569370.RemoveCondition(lTransition_N1569370.conditions[i]);
            }

            UnityEditor.Animations.AnimatorStateTransition lTransition_N1569788 = MotionControllerMotion.EditorFindTransition(lState_N1566382, lState_N1568354, 0);
            if (lTransition_N1569788 == null)
            {
                lTransition_N1569788 = lState_N1566382.AddTransition(lState_N1568354);
            }
            lTransition_N1569788.isExit              = false;
            lTransition_N1569788.hasExitTime         = true;
            lTransition_N1569788.hasFixedDuration    = true;
            lTransition_N1569788.exitTime            = 0.90625f;
            lTransition_N1569788.duration            = 0.25f;
            lTransition_N1569788.offset              = 0f;
            lTransition_N1569788.mute                = false;
            lTransition_N1569788.solo                = false;
            lTransition_N1569788.canTransitionToSelf = true;
            lTransition_N1569788.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lTransition_N1569788.conditions.Length - 1; i >= 0; i--)
            {
                lTransition_N1569788.RemoveCondition(lTransition_N1569788.conditions[i]);
            }

            UnityEditor.Animations.AnimatorStateTransition lTransition_N1569000 = MotionControllerMotion.EditorFindTransition(lState_N1567060, lState_N1568354, 0);
            if (lTransition_N1569000 == null)
            {
                lTransition_N1569000 = lState_N1567060.AddTransition(lState_N1568354);
            }
            lTransition_N1569000.isExit              = false;
            lTransition_N1569000.hasExitTime         = true;
            lTransition_N1569000.hasFixedDuration    = true;
            lTransition_N1569000.exitTime            = 0.7673402f;
            lTransition_N1569000.duration            = 0.2499998f;
            lTransition_N1569000.offset              = 0f;
            lTransition_N1569000.mute                = false;
            lTransition_N1569000.solo                = false;
            lTransition_N1569000.canTransitionToSelf = true;
            lTransition_N1569000.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lTransition_N1569000.conditions.Length - 1; i >= 0; i--)
            {
                lTransition_N1569000.RemoveCondition(lTransition_N1569000.conditions[i]);
            }


            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #9
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_32610            = _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_33036 = lRootSubStateMachine;
            if (lSM_33036 != null)
            {
                for (int i = lSM_33036.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_33036.RemoveEntryTransition(lSM_33036.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_34708 = lSM_33036.AddState("IdlePose", new Vector3(840, 204, 0));
            lS_34708.speed  = 1f;
            lS_34708.motion = m17118;

            UnityEditor.Animations.AnimatorState lS_34710 = lSM_33036.AddState("RunJump_RunForward", new Vector3(588, 288, 0));
            lS_34710.speed  = 1f;
            lS_34710.motion = m17050;

            UnityEditor.Animations.AnimatorState lS_34426 = lSM_33036.AddState("RunningJump", new Vector3(324, 204, 0));
            lS_34426.speed  = 1f;
            lS_34426.motion = m22024;

            UnityEditor.Animations.AnimatorState lS_34712 = lSM_33036.AddState("LandToIdle", new Vector3(588, 204, 0));
            lS_34712.speed  = 1f;
            lS_34712.motion = m20978;

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

            UnityEditor.Animations.AnimatorStateTransition lT_34716 = lS_34426.AddTransition(lS_34710);
            lT_34716.hasExitTime         = false;
            lT_34716.hasFixedDuration    = true;
            lT_34716.exitTime            = 0.8318414f;
            lT_34716.duration            = 0.1f;
            lT_34716.offset              = 0.8475341f;
            lT_34716.mute                = false;
            lT_34716.solo                = false;
            lT_34716.canTransitionToSelf = true;
            lT_34716.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_34716.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 27545f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_34718 = lS_34426.AddTransition(lS_34712);
            lT_34718.hasExitTime         = false;
            lT_34718.hasFixedDuration    = true;
            lT_34718.exitTime            = 0.8032071f;
            lT_34718.duration            = 0.1951104f;
            lT_34718.offset              = 0f;
            lT_34718.mute                = false;
            lT_34718.solo                = false;
            lT_34718.canTransitionToSelf = true;
            lT_34718.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_34718.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 27540f, "L0MotionPhase");

            UnityEditor.Animations.AnimatorStateTransition lT_34720 = lS_34712.AddTransition(lS_34708);
            lT_34720.hasExitTime         = true;
            lT_34720.hasFixedDuration    = true;
            lT_34720.exitTime            = 0.6590909f;
            lT_34720.duration            = 0.25f;
            lT_34720.offset              = 0f;
            lT_34720.mute                = false;
            lT_34720.solo                = false;
            lT_34720.canTransitionToSelf = true;
            lT_34720.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
        }
Beispiel #10
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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lWalkFwdLoop = lMotionStateMachine.AddState("WalkFwdLoop", new Vector3(300, 12, 0));
            lWalkFwdLoop.motion = m185218;
            lWalkFwdLoop.speed  = 1f;

            UnityEditor.Animations.AnimatorState lIdlePose = lMotionStateMachine.AddState("IdlePose", new Vector3(564, 48, 0));
            lIdlePose.motion = m185098;
            lIdlePose.speed  = 1f;

            UnityEditor.Animations.AnimatorState lRunFwdLoop = lMotionStateMachine.AddState("RunFwdLoop", new Vector3(300, 84, 0));
            lRunFwdLoop.motion = m185240;
            lRunFwdLoop.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lWalkFwdLoop.AddTransition(lIdlePose);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.75f;
            lStateTransition.duration         = 0.1f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Less, 0.1f, "InputMagnitude");

            lStateTransition                  = lWalkFwdLoop.AddTransition(lRunFwdLoop);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.75f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.1f, "InputMagnitude");
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1f, "L0MotionParameter");

            lStateTransition                  = lIdlePose.AddTransition(lWalkFwdLoop);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.9f, "InputMagnitude");
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");

            lStateTransition                  = lIdlePose.AddTransition(lRunFwdLoop);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.9f, "InputMagnitude");
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1f, "L0MotionParameter");

            lStateTransition                  = lRunFwdLoop.AddTransition(lIdlePose);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.6428572f;
            lStateTransition.duration         = 0.1f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Less, 0.1f, "InputMagnitude");

            lStateTransition                  = lRunFwdLoop.AddTransition(lWalkFwdLoop);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.6428572f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.1f, "InputMagnitude");
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");
        }
Beispiel #11
0
        public static UnityEditor.Animations.AnimatorStateTransition AddTransitionEx(this UnityEditor.Animations.AnimatorState target, UnityEditor.Animations.AnimatorState toState, AnimatorTransition transitionConfig)
        {
            if (
                (transitionConfig.ignoreSourceAnimNames != null &&
                 transitionConfig.ignoreSourceAnimNames.Contains(target.name))

                ||

                (transitionConfig.ignoreSourceAnimTags != null &&
                 transitionConfig.ignoreSourceAnimTags.Contains(target.tag))

                )
            {
                return(null);
            }


            if (
                (transitionConfig.containSourceAnimNames != null && transitionConfig.containSourceAnimNames.Contains(target.name) == false)

                &&

                (transitionConfig.ignoreSourceAnimTags != null && transitionConfig.ignoreSourceAnimTags.Contains(target.tag) == false)

                )
            {
                return(null);
            }



            // if (nameCanTransition && tagCanTransition)
            {
                var transition = target.AddTransition(toState);

                // transition.interruptionSource = UnityEditor.Animations.TransitionInterruptionSource.Destination;
                transition.interruptionSource = transitionConfig.interruptionSource;// UnityEditor.Animations.TransitionInterruptionSource.Source;

                transition.hasFixedDuration = true;
                transition.hasExitTime      = transitionConfig.hasExitTime;
                transition.exitTime         = transitionConfig.exitTime;
                transition.duration         = transitionConfig.duration;
                transition.offset           = transitionConfig.offset;

                if (transitionConfig.hasFixedDuration == false)
                {
                    if (target.motion is AnimationClip targetClip)
                    {
                        transition.exitTime /= targetClip.length;
                        transition.duration /= targetClip.length;
                        transition.offset   /= targetClip.length;
                    }
                }

                // transition.exitTime = 1;
                // transition.duration = 0;

                // if (transitionConfig.conditions != null)
                // {

                if (transitionConfig.conditions != null)
                {
                    foreach (var conditionConfig in transitionConfig.conditions)
                    {
                        transition.AddCondition(conditionConfig.animatorConditionMode, conditionConfig.threshold, conditionConfig.parameter);
                    }
                }

                // }

                return(transition);
            }

            // return null;
        }
Beispiel #12
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 #13
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_N2076296 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicHandPose-SM");
            if (lSSM_N2076296 == null)
            {
                lSSM_N2076296 = lLayerStateMachine.AddStateMachine("BasicHandPose-SM", new Vector3(324, 0, 0));
            }

            UnityEditor.Animations.AnimatorState lState_N2076298 = MotionControllerMotion.EditorFindState(lSSM_N2076296, "Empty");
            if (lState_N2076298 == null)
            {
                lState_N2076298 = lSSM_N2076296.AddState("Empty", new Vector3(648, -144, 0));
            }
            lState_N2076298.speed  = 1f;
            lState_N2076298.mirror = false;
            lState_N2076298.tag    = "Exit";

            UnityEditor.Animations.AnimatorState lState_N2076300 = MotionControllerMotion.EditorFindState(lSSM_N2076296, "Default HandPose");
            if (lState_N2076300 == null)
            {
                lState_N2076300 = lSSM_N2076296.AddState("Default HandPose", new Vector3(348, -144, 0));
            }
            lState_N2076300.speed  = 1f;
            lState_N2076300.mirror = false;
            lState_N2076300.tag    = "";

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

            UnityEditor.Animations.AnimatorStateTransition lTransition_N2076304 = MotionControllerMotion.EditorFindTransition(lState_N2076300, lState_N2076298, 0);
            if (lTransition_N2076304 == null)
            {
                lTransition_N2076304 = lState_N2076300.AddTransition(lState_N2076298);
            }
            lTransition_N2076304.isExit              = false;
            lTransition_N2076304.hasExitTime         = false;
            lTransition_N2076304.hasFixedDuration    = true;
            lTransition_N2076304.exitTime            = 0.75f;
            lTransition_N2076304.duration            = 0.25f;
            lTransition_N2076304.offset              = 0f;
            lTransition_N2076304.mute                = false;
            lTransition_N2076304.solo                = false;
            lTransition_N2076304.canTransitionToSelf = true;
            lTransition_N2076304.orderedInterruption = true;
            lTransition_N2076304.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lTransition_N2076304.conditions.Length - 1; i >= 0; i--)
            {
                lTransition_N2076304.RemoveCondition(lTransition_N2076304.conditions[i]);
            }
            lTransition_N2076304.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 3661f, "L" + rLayerIndex + "MotionPhase");


            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #14
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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lStanding_Walk_Forward = lMotionStateMachine.AddState("Standing_Walk_Forward", new Vector3(360, -120, 0));
            lStanding_Walk_Forward.motion = m182328;
            lStanding_Walk_Forward.speed  = 1f;

            UnityEditor.Animations.AnimatorState lStanding_Run_Forward = lMotionStateMachine.AddState("Standing_Run_Forward", new Vector3(360, 144, 0));
            lStanding_Run_Forward.motion = m182412;
            lStanding_Run_Forward.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lStanding_Walk_Forward.AddTransition(lStanding_Run_Forward);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.3077585f;
            lStateTransition.duration         = 0.7845403f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1f, "L0MotionParameter");

            lStateTransition                  = lStanding_Run_Forward.AddTransition(lStanding_Walk_Forward);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.6590909f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
        }
Beispiel #15
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_31068 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicJump-SM");
            if (lSSM_31068 == null)
            {
                lSSM_31068 = lLayerStateMachine.AddStateMachine("BasicJump-SM", new Vector3(192, -864, 0));
            }

            UnityEditor.Animations.AnimatorState lState_31422 = MotionControllerMotion.EditorFindState(lSSM_31068, "Unarmed Jump");
            if (lState_31422 == null)
            {
                lState_31422 = lSSM_31068.AddState("Unarmed Jump", new Vector3(360, -60, 0));
            }
            lState_31422.speed  = 1.1f;
            lState_31422.mirror = false;
            lState_31422.tag    = "";
            lState_31422.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Jumping/ootii_StandingJump.fbx", "StandingJump");

            UnityEditor.Animations.AnimatorState lState_32404 = MotionControllerMotion.EditorFindState(lSSM_31068, "IdlePose");
            if (lState_32404 == null)
            {
                lState_32404 = lSSM_31068.AddState("IdlePose", new Vector3(600, -60, 0));
            }
            lState_32404.speed  = 1f;
            lState_32404.mirror = false;
            lState_32404.tag    = "Exit";
            lState_32404.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Idling/unity_Idle_IdleToIdlesR.fbx", "IdlePose");

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

            UnityEditor.Animations.AnimatorStateTransition lTransition_32406 = MotionControllerMotion.EditorFindTransition(lState_31422, lState_32404, 0);
            if (lTransition_32406 == null)
            {
                lTransition_32406 = lState_31422.AddTransition(lState_32404);
            }
            lTransition_32406.isExit              = false;
            lTransition_32406.hasExitTime         = true;
            lTransition_32406.hasFixedDuration    = true;
            lTransition_32406.exitTime            = 0.7643284f;
            lTransition_32406.duration            = 0.25f;
            lTransition_32406.offset              = 0f;
            lTransition_32406.mute                = false;
            lTransition_32406.solo                = false;
            lTransition_32406.canTransitionToSelf = true;
            lTransition_32406.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            for (int i = lTransition_32406.conditions.Length - 1; i >= 0; i--)
            {
                lTransition_32406.RemoveCondition(lTransition_32406.conditions[i]);
            }

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

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

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

            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #16
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_41656            = _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_41686 = lRootSubStateMachine;
            if (lSM_41686 != null)
            {
                for (int i = lSM_41686.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_41686.RemoveEntryTransition(lSM_41686.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_42706 = lSM_41686.AddState("Spell Idle Out", new Vector3(576, 48, 0));
            lS_42706.speed  = 1f;
            lS_42706.motion = m20620;

            UnityEditor.Animations.AnimatorState lS_42708 = lSM_41686.AddState("Stand Idle Out", new Vector3(576, 120, 0));
            lS_42708.speed  = 1f;
            lS_42708.motion = m17212;

            UnityEditor.Animations.AnimatorState lS_41992 = lSM_41686.AddState("Store Spell", new Vector3(312, 120, 0));
            lS_41992.speed  = -1.1f;
            lS_41992.motion = m19754;

            UnityEditor.Animations.AnimatorState lS_41990 = lSM_41686.AddState("Equip Spell", new Vector3(312, 48, 0));
            lS_41990.speed  = 1.1f;
            lS_41990.motion = m19754;

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

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

            UnityEditor.Animations.AnimatorStateTransition lT_42710 = lS_41992.AddTransition(lS_42708);
            lT_42710.hasExitTime         = true;
            lT_42710.hasFixedDuration    = true;
            lT_42710.exitTime            = 0.8857439f;
            lT_42710.duration            = 0.1033962f;
            lT_42710.offset              = 1.507076f;
            lT_42710.mute                = false;
            lT_42710.solo                = false;
            lT_42710.canTransitionToSelf = true;
            lT_42710.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;

            UnityEditor.Animations.AnimatorStateTransition lT_42712 = lS_41990.AddTransition(lS_42706);
            lT_42712.hasExitTime         = true;
            lT_42712.hasFixedDuration    = true;
            lT_42712.exitTime            = 0.5385581f;
            lT_42712.duration            = 0.3215042f;
            lT_42712.offset              = 0f;
            lT_42712.mute                = false;
            lT_42712.solo                = false;
            lT_42712.canTransitionToSelf = true;
            lT_42712.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
        }
Beispiel #17
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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lfloat = lMotionStateMachine.AddState("float", new Vector3(324, 72, 0));
            lfloat.motion = mfloat;
            lfloat.speed  = 1f;

            UnityEditor.Animations.AnimatorState lflying = lMotionStateMachine.AddState("flying", new Vector3(612, 72, 0));
            lflying.motion = mflying;
            lflying.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lfloat.AddTransition(lflying);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Greater, 0.9f, "InputY");

            lStateTransition                  = lflying.AddTransition(lfloat);
            lStateTransition.hasExitTime      = false;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.9050633f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
            lStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Less, 0.9f, "InputY");
        }
Beispiel #18
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_25382            = _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_N1608508 = lRootSubStateMachine;
            if (lSM_N1608508 != null)
            {
                for (int i = lSM_N1608508.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_N1608508.RemoveEntryTransition(lSM_N1608508.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_N1612918 = lSM_N1608508.AddState("LandToIdle", new Vector3(720, 264, 0));
            lS_N1612918.speed  = 1f;
            lS_N1612918.motion = m16578;

            UnityEditor.Animations.AnimatorState lS_N1612942 = lSM_N1608508.AddState("FallToLand", new Vector3(480, 264, 0));
            lS_N1612942.speed  = 1f;
            lS_N1612942.motion = m16574;

            UnityEditor.Animations.AnimatorState lS_N1626950 = lSM_N1608508.AddState("FallPose", new Vector3(240, 264, 0));
            lS_N1626950.speed  = 1f;
            lS_N1626950.motion = m16572;

            UnityEditor.Animations.AnimatorState lS_N1644298 = lSM_N1608508.AddState("IdlePose", new Vector3(960, 264, 0));
            lS_N1644298.speed  = 1f;
            lS_N1644298.motion = m14540;

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

            UnityEditor.Animations.AnimatorStateTransition lT_N1644504 = lS_N1612918.AddTransition(lS_N1644298);
            lT_N1644504.hasExitTime         = true;
            lT_N1644504.hasFixedDuration    = true;
            lT_N1644504.exitTime            = 0.8141199f;
            lT_N1644504.duration            = 0.116312f;
            lT_N1644504.offset              = 0f;
            lT_N1644504.mute                = false;
            lT_N1644504.solo                = false;
            lT_N1644504.canTransitionToSelf = true;
            lT_N1644504.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;

            UnityEditor.Animations.AnimatorStateTransition lT_N1612980 = lS_N1612942.AddTransition(lS_N1612918);
            lT_N1612980.hasExitTime         = true;
            lT_N1612980.hasFixedDuration    = true;
            lT_N1612980.exitTime            = 0.5f;
            lT_N1612980.duration            = 0.2f;
            lT_N1612980.offset              = 0.485189f;
            lT_N1612980.mute                = false;
            lT_N1612980.solo                = false;
            lT_N1612980.canTransitionToSelf = true;
            lT_N1612980.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;

            UnityEditor.Animations.AnimatorStateTransition lT_N1626992 = lS_N1626950.AddTransition(lS_N1612942);
            lT_N1626992.hasExitTime         = false;
            lT_N1626992.hasFixedDuration    = true;
            lT_N1626992.exitTime            = 1f;
            lT_N1626992.duration            = 0.1f;
            lT_N1626992.offset              = 0f;
            lT_N1626992.mute                = false;
            lT_N1626992.solo                = false;
            lT_N1626992.canTransitionToSelf = true;
            lT_N1626992.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_N1626992.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1805f, "L0MotionPhase");
        }
Beispiel #19
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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lWalkVault_1m = lMotionStateMachine.AddState("WalkVault_1m", new Vector3(348, 12, 0));
            lWalkVault_1m.motion = mWalkVault_1m;
            lWalkVault_1m.speed  = 1f;

            UnityEditor.Animations.AnimatorState lWalkForward = lMotionStateMachine.AddState("WalkForward", new Vector3(600, 12, 0));
            lWalkForward.motion = mWalkForward;
            lWalkForward.speed  = 1f;

            UnityEditor.Animations.AnimatorState lRunVault_1m = lMotionStateMachine.AddState("RunVault_1m", new Vector3(348, 96, 0));
            lRunVault_1m.motion = mRunVault_1m;
            lRunVault_1m.speed  = 1f;

            UnityEditor.Animations.AnimatorState lRunForward = lMotionStateMachine.AddState("RunForward", new Vector3(600, 96, 0));
            lRunForward.motion = mRunForward;
            lRunForward.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lWalkVault_1m.AddTransition(lWalkForward);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.7967739f;
            lStateTransition.duration         = 0.103878f;
            lStateTransition.offset           = 0.0009236346f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;

            lStateTransition                  = lRunVault_1m.AddTransition(lRunForward);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.8584905f;
            lStateTransition.duration         = 0.2499999f;
            lStateTransition.offset           = 0.4060542f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
        }
Beispiel #20
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;

            // 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)
                {
                    // 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);
                }
            }

            UnityEditor.Animations.AnimatorStateMachine lMotionStateMachine = lRootStateMachine.AddStateMachine(_EditorAnimatorSMName);

            // Attach the behaviour if needed
            if (_EditorAttachBehaviour)
            {
                MotionControllerBehaviour lBehaviour = lMotionStateMachine.AddStateMachineBehaviour(typeof(MotionControllerBehaviour)) as MotionControllerBehaviour;
                lBehaviour._MotionKey = (_Key.Length > 0 ? _Key : this.GetType().FullName);
            }

            UnityEditor.Animations.AnimatorState lIdleClimbMid = lMotionStateMachine.AddState("IdleClimbMid", new Vector3(264, 12, 0));
            lIdleClimbMid.motion = mIdleClimbMid;
            lIdleClimbMid.speed  = 1f;

            UnityEditor.Animations.AnimatorState lClimbRecoverIdle = lMotionStateMachine.AddState("ClimbRecoverIdle", new Vector3(504, -36, 0));
            lClimbRecoverIdle.motion = mClimbRecoverIdle;
            lClimbRecoverIdle.speed  = 1f;

            UnityEditor.Animations.AnimatorState lIdlePose = lMotionStateMachine.AddState("IdlePose", new Vector3(504, 36, 0));
            lIdlePose.motion = mIdlePose;
            lIdlePose.speed  = 1f;

            UnityEditor.Animations.AnimatorStateTransition lAnyStateTransition = null;

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

            UnityEditor.Animations.AnimatorStateTransition lStateTransition = null;

            lStateTransition                  = lIdleClimbMid.AddTransition(lClimbRecoverIdle);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = false;
            lStateTransition.exitTime         = 1.00067f;
            lStateTransition.duration         = 0f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = true;
            lStateTransition.solo             = false;

            lStateTransition                  = lIdleClimbMid.AddTransition(lIdlePose);
            lStateTransition.hasExitTime      = true;
            lStateTransition.hasFixedDuration = true;
            lStateTransition.exitTime         = 0.8125f;
            lStateTransition.duration         = 0.25f;
            lStateTransition.offset           = 0f;
            lStateTransition.mute             = false;
            lStateTransition.solo             = false;
        }
Beispiel #21
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");
        }