/// <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_37928 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicEquipStore-SM"); if (lSSM_37928 == null) { lSSM_37928 = lLayerStateMachine.AddStateMachine("BasicEquipStore-SM", new Vector3(192, -1008, 0)); } #if USE_ARCHERY_MP || OOTII_AYMP ArcheryPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SWORD_SHIELD_MP || OOTII_SSMP SwordShieldPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SPELL_CASTING_MP || OOTII_SCMP SpellCastingPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SHOOTER_MP || OOTII_SHMP ShooterPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif // Run any post processing after creating the state machine OnStateMachineCreated(); }
public void NewClipSelected(AnimationClip activeNonNull) { _state.CurrentClip = activeNonNull; // FIXME _state._editableProperties and animationEditorState._stats will have a content that depends on the currently active dummy!!! // FIXME: not only it depends on the currently active dummy, that dummy must not be animated too. // FIXME: For now, only consider blendshapes with a value of 0. _state.EditableBlendshapes = AnimationUtility.GetCurveBindings(_state.CurrentClip) .Where(binding => binding.type == typeof(SkinnedMeshRenderer) && binding.propertyName.StartsWith("blendShape.")) .Where(binding => AnimationUtility.GetEditorCurve(_state.CurrentClip, binding).keys.All(keyframe => keyframe.value != 0)) .Select(binding => EditableBlendshapeFromActive(_state.CurrentClip, binding)).ToList(); RecalculateStats(); var dummy = _state.InternalDummyOptional(); if (dummy.HasValue) { var fakeController = new UnityEditor.Animations.AnimatorController(); fakeController.name = "Fake Temporary Controller__DoNotModify"; fakeController.AddLayer("Base"); var animatorState = fakeController.layers[0].stateMachine.AddState("recorder"); animatorState.motion = activeNonNull; animatorState.writeDefaultValues = false; dummy.Value.Dummy.runtimeAnimatorController = fakeController; } _previewHandler.GeneratePreviewsFromCurrentClip(); }
public void It_should_set_an_Animator_bool() { var fsm = Substitute.For <IFsm>(); fsm.Owner.Returns(_go); var state = Substitute.For <IState>(); state.ParentFsm.Returns(fsm); var param = new AnimatorControllerParameter { name = "a", type = AnimatorControllerParameterType.Bool }; var animator = _go.AddComponent <Animator>(); var animatorCtrl = new AnimatorController { parameters = new[] { param } }; animatorCtrl.AddLayer("Default"); animator.runtimeAnimatorController = animatorCtrl; var action = new ActionSetAnimatorBool("a", true) { ParentState = state }; action.Enter(); Assert.AreEqual(true, animator.GetBool("a")); }
/// <summary> /// Creates a Unity sprite animation from the given <see cref="Layer"/> that is a group layer. It grabs all of the children art /// layers and uses them as the frames of the animation. /// </summary> /// <param name="layer">The group <see cref="Layer"/> to use to create the sprite animation.</param> private static void CreateAnimation(Layer layer) { float fps = 30; string[] args = layer.Name.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string arg in args) { if (arg.ContainsIgnoreCase("FPS=")) { layer.Name = layer.Name.Replace("|" + arg, string.Empty); string[] fpsArgs = arg.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (!float.TryParse(fpsArgs[1], out fps)) { Debug.LogError(string.Format("Unable to parse FPS: \"{0}\"", arg)); } } } List <Sprite> frames = new List <Sprite>(); Layer firstChild = layer.Children.First(); SpriteRenderer spriteRenderer = CreateSpriteGameObject(firstChild); spriteRenderer.name = layer.Name; foreach (Layer child in layer.Children) { frames.Add(CreateSprite(child, layer.Name)); } spriteRenderer.sprite = frames[0]; //if UNITY_5 // Create Animator Controller with an Animation Clip UnityEditor.Animations.AnimatorController controller = new UnityEditor.Animations.AnimatorController(); controller.AddLayer("Base Layer"); UnityEditor.Animations.AnimatorControllerLayer controllerLayer = controller.layers[0]; UnityEditor.Animations.AnimatorState state = controllerLayer.stateMachine.AddState(layer.Name); state.motion = CreateSpriteAnimationClip(layer.Name, frames, fps); AssetDatabase.CreateAsset(controller, GetRelativePath(currentPath) + "/" + layer.Name + ".controller"); //#else // Unity 4 // // Create Animator Controller with an Animation Clip // AnimatorController controller = new AnimatorController(); // AnimatorControllerLayer controllerLayer = controller.AddLayer("Base Layer"); // State state = controllerLayer.stateMachine.AddState(layer.Name); // state.SetAnimationClip(CreateSpriteAnimationClip(layer.Name, frames, fps)); // AssetDatabase.CreateAsset(controller, GetRelativePath(currentPath) + "/" + layer.Name + ".controller"); //#endif // Add an Animator and assign it the controller Animator animator = spriteRenderer.gameObject.AddComponent <Animator>(); animator.runtimeAnimatorController = controller; }
void AddLayerMountedCombat(UnityEditor.Animations.AnimatorController CurrentAnimator) { UnityEditor.Animations.AnimatorController MountAnimator = Resources.Load <UnityEditor.Animations.AnimatorController>("Layers/Combat"); Rider3rdPersonEditor.AddParametersOnAnimator(CurrentAnimator, MountAnimator); foreach (var item in MountAnimator.layers) { CurrentAnimator.AddLayer(item); } }
void AddLayerMounted(UnityEditor.Animations.AnimatorController AnimController) { var MountAnimator = Resources.Load <UnityEditor.Animations.AnimatorController>(M.LayerPath); AddParametersOnAnimator(AnimController, MountAnimator); foreach (var item in MountAnimator.layers) { AnimController.AddLayer(item); } }
public static UnityEditor.Animations.AnimatorController CreateAnimatorControllerAtPath(string path) { UnityEditor.Animations.AnimatorController asset = new UnityEditor.Animations.AnimatorController { name = Path.GetFileName(path) }; AssetDatabase.CreateAsset(asset, path); asset.pushUndo = false; asset.AddLayer("Base Layer"); asset.pushUndo = true; return(asset); }
void AddLayerMountedCombat(UnityEditor.Animations.AnimatorController CurrentAnimator) { UnityEditor.Animations.AnimatorController MountAnimator = Resources.Load <UnityEditor.Animations.AnimatorController>(M.CombatLayerPath); MTools.AddParametersOnAnimator(CurrentAnimator, MountAnimator); foreach (var item in MountAnimator.layers) { CurrentAnimator.AddLayer(item); } }
/// <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_N2456644 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicIdleArms-SM"); if (lSSM_N2456644 == null) { lSSM_N2456644 = lLayerStateMachine.AddStateMachine("BasicIdleArms-SM", new Vector3(192, -816, 0)); } // Run any post processing after creating the state machine OnStateMachineCreated(); }
/// <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(); }
/// <summary> /// Creates a Unity sprite animation from the given <see cref="Layer"/> that is a group layer. It grabs all of the children art /// layers and uses them as the frames of the animation. /// </summary> /// <param name="layer">The group <see cref="Layer"/> to use to create the sprite animation.</param> private static void CreateAnimation(Layer layer) { float fps = 30; string[] args = layer.Name.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string arg in args) { if (arg.ContainsIgnoreCase("FPS=")) { layer.Name = layer.Name.Replace("|" + arg, string.Empty); string[] fpsArgs = arg.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (!float.TryParse(fpsArgs[1], out fps)) { Debug.LogError(string.Format("Unable to parse FPS: \"{0}\"", arg)); } } } List<Sprite> frames = new List<Sprite>(); Layer firstChild = layer.Children.First(); SpriteRenderer spriteRenderer = CreateSpriteGameObject(firstChild); spriteRenderer.name = layer.Name; foreach (Layer child in layer.Children) { frames.Add(CreateSprite(child, layer.Name)); } spriteRenderer.sprite = frames[0]; #if UNITY_5 // Create Animator Controller with an Animation Clip UnityEditor.Animations.AnimatorController controller = new UnityEditor.Animations.AnimatorController(); controller.AddLayer("Base Layer"); UnityEditor.Animations.AnimatorControllerLayer controllerLayer = controller.layers[0]; UnityEditor.Animations.AnimatorState state = controllerLayer.stateMachine.AddState(layer.Name); state.motion = CreateSpriteAnimationClip(layer.Name, frames, fps); AssetDatabase.CreateAsset(controller, GetRelativePath(currentPath) + "/" + layer.Name + ".controller"); #else // Unity 4 // Create Animator Controller with an Animation Clip AnimatorController controller = new AnimatorController(); AnimatorControllerLayer controllerLayer = controller.AddLayer("Base Layer"); State state = controllerLayer.stateMachine.AddState(layer.Name); state.SetAnimationClip(CreateSpriteAnimationClip(layer.Name, frames, fps)); AssetDatabase.CreateAsset(controller, GetRelativePath(currentPath) + "/" + layer.Name + ".controller"); #endif // Add an Animator and assign it the controller Animator animator = spriteRenderer.gameObject.AddComponent<Animator>(); animator.runtimeAnimatorController = controller; }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <summary> /// Creates the preview state machine. /// </summary> /// <param name="motion">Motion.</param> private void CreatePreviewStateMachine(Motion motion) { if (this.Animator == null) return; //Debug.Log ("CreateStateMachine"); if (_previewAnimatorController == null) { _previewAnimatorController = new UnityEditor.Animations.AnimatorController (); _previewAnimatorController.AddLayer ("previewLayer"); _previewAnimatorController.hideFlags = HideFlags.DontSave; _previewStateMachine = _previewAnimatorController.layers [0].stateMachine; CreateParameters (motion); _previewState = _previewStateMachine.AddState ("previewState"); _previewState.motion = motion; _previewState.iKOnFeet = this.IKOnFeet; _previewState.hideFlags = HideFlags.DontSave; UnityEditor.Animations.AnimatorController.SetAnimatorController (this.Animator, _previewAnimatorController); //Debug.Log ("Setting avatarPreview.Animator " + this.Animator.name + " to temp controller"); } // if (AnimatorController.GetEffectiveAnimatorController (this.Animator) != this._previewAnimatorController) { // AnimatorController.SetAnimatorController (this.Animator, this._previewAnimatorController); // // Debug.Log ("Getting Effective Animator and set avatarPreview.Animator " + this.Animator.name + " to temp controller"); // } }