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