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;

            // 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(264, 72, 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(lIdlePose);
            lAnyStateTransition.hasExitTime      = false;
            lAnyStateTransition.hasFixedDuration = true;
            lAnyStateTransition.exitTime         = 0.8144876f;
            lAnyStateTransition.duration         = 0.01185336f;
            lAnyStateTransition.offset           = 0f;
            lAnyStateTransition.mute             = false;
            lAnyStateTransition.solo             = false;
            lAnyStateTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 100f, "L0MotionPhase");
        }
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>
        /// New way to create sub-state machines without destroying what exists first.
        /// </summary>
        protected override void CreateStateMachine()
        {
            int rLayerIndex = mMotionLayer._AnimatorLayerIndex;
            MotionController rMotionController = mMotionController;

            UnityEditor.Animations.AnimatorController lController = null;

            Animator lAnimator = rMotionController.Animator;

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

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

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

            UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine;

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

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

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

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

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

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

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

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

            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #4
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_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 #5
0
        /// <summary>
        /// New way to create sub-state machines without destroying what exists first.
        /// </summary>
        protected override void CreateStateMachine()
        {
            int rLayerIndex = mMotionLayer._AnimatorLayerIndex;
            MotionController rMotionController = mMotionController;

            UnityEditor.Animations.AnimatorController lController = null;

            Animator lAnimator = rMotionController.Animator;

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

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

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

            UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine;

            UnityEditor.Animations.AnimatorStateMachine lSSM_N237494 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicDeath-SM");
            if (lSSM_N237494 == null)
            {
                lSSM_N237494 = lLayerStateMachine.AddStateMachine("BasicDeath-SM", new Vector3(192, -912, 0));
            }

            UnityEditor.Animations.AnimatorState lState_N247470 = MotionControllerMotion.EditorFindState(lSSM_N237494, "Unarmed Death 0");
            if (lState_N247470 == null)
            {
                lState_N247470 = lSSM_N237494.AddState("Unarmed Death 0", new Vector3(324, -72, 0));
            }
            lState_N247470.speed  = 1.5f;
            lState_N247470.mirror = false;
            lState_N247470.tag    = "";
            lState_N247470.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Utilities/Utilities_01.fbx", "DeathBackward");

            UnityEditor.Animations.AnimatorState lState_N247472 = MotionControllerMotion.EditorFindState(lSSM_N237494, "Unarmed Death 180");
            if (lState_N247472 == null)
            {
                lState_N247472 = lSSM_N237494.AddState("Unarmed Death 180", new Vector3(324, -24, 0));
            }
            lState_N247472.speed  = 1.8f;
            lState_N247472.mirror = false;
            lState_N247472.tag    = "";
            lState_N247472.motion = MotionControllerMotion.EditorFindAnimationClip("Assets/ootii/Assets/MotionController/Content/Animations/Humanoid/Utilities/Utilities_01.fbx", "DeathForward");

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

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

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

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

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

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

            // Run any post processing after creating the state machine
            OnStateMachineCreated();
        }
Beispiel #6
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_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_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 #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();
        }
 public AnimatorStateTransition(AnimatorStateMachine sm, AnimatorState parentSate, UnityEditor.Animations.AnimatorStateTransition t)
     : this(sm, parentSate, (UnityEditor.Animations.AnimatorTransitionBase)t)
 {
     this.duration            = t.duration;
     this.offset              = t.offset;
     this.interruptionSource  = (int)t.interruptionSource;
     this.orderedInterruption = t.orderedInterruption;
     this.exitTime            = t.exitTime;
     this.hasExitTime         = t.hasExitTime;
     this.hasFixedDuration    = t.hasFixedDuration;
     this.canTransitionToSelf = t.canTransitionToSelf;
 }
Beispiel #10
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 #11
0
        /// <summary>
        /// Creates the animator substate machine for this motion.
        /// </summary>
        protected override void CreateStateMachine()
        {
            // Grab the root sm for the layer
            UnityEditor.Animations.AnimatorStateMachine lRootStateMachine    = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lSM_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 #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_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 #13
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 #14
0
        /// <summary>
        /// New way to create sub-state machines without destroying what exists first.
        /// </summary>
        protected override void CreateStateMachine()
        {
            int rLayerIndex = mMotionLayer._AnimatorLayerIndex;
            MotionController rMotionController = mMotionController;

            UnityEditor.Animations.AnimatorController lController = null;

            Animator lAnimator = rMotionController.Animator;

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

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

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

            UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine;

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

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

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

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

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

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

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

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

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

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

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

            lM_25600.AddChild(lM_25694, 0.5f);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // 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 #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;
            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 #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_38592            = _EditorAnimatorController.layers[mMotionLayer.AnimatorLayerIndex].stateMachine;
            UnityEditor.Animations.AnimatorStateMachine lRootSubStateMachine = null;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            lM_N2165324.AddChild(lM_N2165328, 0.5f);

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

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

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

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

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

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

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

            UnityEditor.Animations.AnimatorStateTransition lT_N2165340 = lS_N2165322.AddTransition(lS_N2165320);
            lT_N2165340.hasExitTime         = false;
            lT_N2165340.hasFixedDuration    = true;
            lT_N2165340.exitTime            = 1f;
            lT_N2165340.duration            = 0.25f;
            lT_N2165340.offset              = 0f;
            lT_N2165340.mute                = false;
            lT_N2165340.solo                = false;
            lT_N2165340.canTransitionToSelf = true;
            lT_N2165340.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 0;
            lT_N2165340.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 32215f, "L0MotionPhase");
            lT_N2165340.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L0MotionParameter");
        }
Beispiel #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;
            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");
        }
        /// <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 #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_34270            = _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_35666 = lRootSubStateMachine;
            if (lSM_35666 != null)
            {
                for (int i = lSM_35666.entryTransitions.Length - 1; i >= 0; i--)
                {
                    lSM_35666.RemoveEntryTransition(lSM_35666.entryTransitions[i]);
                }

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

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

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

            UnityEditor.Animations.AnimatorState lS_35692 = lSM_35666.AddState("EmptyPose", new Vector3(312, 84, 0));
            lS_35692.speed = 1f;

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_35676 = lRootStateMachine.AddAnyStateTransition(lS_35692);
            lT_35676.hasExitTime         = false;
            lT_35676.hasFixedDuration    = true;
            lT_35676.exitTime            = 0.75f;
            lT_35676.duration            = 0.15f;
            lT_35676.offset              = 0f;
            lT_35676.mute                = false;
            lT_35676.solo                = false;
            lT_35676.canTransitionToSelf = false;
            lT_35676.orderedInterruption = false;
            lT_35676.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 2;
            lT_35676.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 3010f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionPhase");
            lT_35676.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionForm");
            lT_35676.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionParameter");

            // Create the transition from the any state. Note that 'AnyState' transitions have to be added to the root
            UnityEditor.Animations.AnimatorStateTransition lT_35678 = lRootStateMachine.AddAnyStateTransition(lS_35692);
            lT_35678.hasExitTime         = false;
            lT_35678.hasFixedDuration    = true;
            lT_35678.exitTime            = 0.75f;
            lT_35678.duration            = 0f;
            lT_35678.offset              = 0f;
            lT_35678.mute                = false;
            lT_35678.solo                = false;
            lT_35678.canTransitionToSelf = false;
            lT_35678.orderedInterruption = false;
            lT_35678.interruptionSource  = (UnityEditor.Animations.TransitionInterruptionSource) 2;
            lT_35678.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 3010f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionPhase");
            lT_35678.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 0f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionForm");
            lT_35678.AddCondition(UnityEditor.Animations.AnimatorConditionMode.Equals, 1f, "L" + mMotionLayer._AnimatorLayerIndex + "MotionParameter");
        }
Beispiel #22
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");
        }