Hygiene B4c: clean dedup helpers (knockback, bakers, editor rig)
- KnockbackUtil.Stamp: shared knockback-stamp used by AbilityFireSystem + MeleeComboSystem (guard + planar normalize + write; speed passed in). - BakerStructureExt: AddPlacedStructure/AddDamageable extensions on Baker<T>; rewired Turret/Structure/Harvester/Conveyor/Fabricator bakers (baked data + serialized fields unchanged). - EnemyPrefabBakeExt.AddEnemyPrefabPool: shared prefab-buffer bake for ZoneEnemyDirector/WaveDirector authoring (fields stay flat — no serialization change). - Editor AnimRigUtil (HasParam + root-yaw overlay clip) shared by PlayerRigTools/EnemyRigTools; EnemyRigTools.MakeMat now GUID-preserving (CopySerialized over existing) — the composite AnimatorController copy left as-is with a caveat comment. 466/466 EditMode tests pass, 0 warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,22 +30,11 @@ namespace ProjectM.EditorTools
|
||||
// Full idle pose (every bone keyed) + a Root yaw twist. See the class summary for why a Root-only clip sinks.
|
||||
var clip = AssetDatabase.LoadAssetAtPath<AnimationClip>(SwingClip);
|
||||
if (clip == null) { clip = new AnimationClip { frameRate = 30f }; AssetDatabase.CreateAsset(clip, SwingClip); }
|
||||
clip.ClearCurves();
|
||||
foreach (var b in AnimationUtility.GetCurveBindings(idle))
|
||||
{
|
||||
if (b.path == "Root") continue; // the Root is driven below
|
||||
AnimationUtility.SetEditorCurve(clip, b, AnimationUtility.GetEditorCurve(idle, b));
|
||||
}
|
||||
var yaw = new AnimationCurve(
|
||||
new Keyframe(0f, 0f), new Keyframe(0.06f, -25f), new Keyframe(0.16f, 48f), new Keyframe(0.30f, 0f));
|
||||
AnimationUtility.SetEditorCurve(clip, EditorCurveBinding.FloatCurve("Root", typeof(Transform), "localEulerAnglesRaw.y"), yaw);
|
||||
var s = AnimationUtility.GetAnimationClipSettings(clip);
|
||||
s.loopTime = false;
|
||||
AnimationUtility.SetAnimationClipSettings(clip, s);
|
||||
EditorUtility.SetDirty(clip);
|
||||
AssetDatabase.SaveAssets();
|
||||
AnimRigUtil.BuildRootYawOverlayClip(clip, idle, yaw);
|
||||
|
||||
if (!HasParam(ac, "IsAttacking"))
|
||||
if (!AnimRigUtil.HasParam(ac, "IsAttacking"))
|
||||
ac.AddParameter("IsAttacking", AnimatorControllerParameterType.Bool);
|
||||
|
||||
var sm = ac.layers[0].stateMachine;
|
||||
@@ -80,12 +69,6 @@ namespace ProjectM.EditorTools
|
||||
return null;
|
||||
}
|
||||
|
||||
static bool HasParam(AnimatorController ac, string name)
|
||||
{
|
||||
foreach (var p in ac.parameters) if (p.name == name) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static AnimatorState FindState(AnimatorStateMachine sm, string name)
|
||||
{
|
||||
foreach (var c in sm.states) if (c.state.name == name) return c.state;
|
||||
|
||||
Reference in New Issue
Block a user