// Copy all parameters to the new animator void UpdateParametersOnAnimator(AnimatorController AnimController) { AnimatorControllerParameter[] parameters = AnimController.parameters; //RIDER COMBAT!!!!!!!!!! if (!Rider3rdPersonEditor.SearchParameter(parameters, "WeaponAim")) { AnimController.AddParameter("WeaponAim", UnityEngine.AnimatorControllerParameterType.Float); } if (!Rider3rdPersonEditor.SearchParameter(parameters, "WeaponType")) { AnimController.AddParameter("WeaponType", UnityEngine.AnimatorControllerParameterType.Int); } if (!Rider3rdPersonEditor.SearchParameter(parameters, "WeaponHolder")) { AnimController.AddParameter("WeaponHolder", UnityEngine.AnimatorControllerParameterType.Int); } if (!Rider3rdPersonEditor.SearchParameter(parameters, "WeaponAction")) { AnimController.AddParameter("WeaponAction", UnityEngine.AnimatorControllerParameterType.Int); } }
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 AddLayerMountedCombat(AnimatorController CurrentAnimator) { AnimatorController MountedLayerFile = Resources.Load <AnimatorController>("Mounted Layer"); Rider3rdPersonEditor.UpdateParametersOnAnimator(CurrentAnimator); UpdateParametersOnAnimator(CurrentAnimator); //Adding the Parameters Needed AnimatorControllerLayer RiderCombatLayers = MountedLayerFile.layers[2]; //Search For the 2nd Layer to Add CurrentAnimator.AddLayer(RiderCombatLayers); //Add "Rider Arm Right" Layer RiderCombatLayers = MountedLayerFile.layers[3]; CurrentAnimator.AddLayer(RiderCombatLayers); //Add "Rider Arm Left" Layer RiderCombatLayers = MountedLayerFile.layers[4]; CurrentAnimator.AddLayer(RiderCombatLayers); //Add "Rider Combat" Layer }