using Unity.Mathematics;
namespace ProjectM.Client
{
/// 07-21 G4 (review wf_98bf1268) — pure co-op saturation-budget math (no ECS; unit-tested like
/// HudVisualMath, the Client-side presentation-math precedent). Maps a live on-screen enemy count to
/// the ALLY-FX degradation scale: 1 at <= start, linear down to at >= full.
/// Enemy telegraphs never ride this (guidelines G4: they never degrade); local-player FX never ride this.
/// Note: EnemyMarkerSystem's pip fade equals AllyScale(count, start, 2*start, floor) — a later
/// pass can retrofit it onto this helper.
public static class SaturationMath
{
/// 1 at enemies <= start; linear to at enemies >= full; clamped.
/// Degenerate inputs (full <= start) snap straight to floor once past start.
public static float AllyScale(int enemies, int start, int full, float floor)
{
floor = math.clamp(floor, 0f, 1f);
if (enemies <= start) return 1f;
if (full <= start) return floor;
float t = math.saturate((enemies - start) / (float)(full - start));
return math.lerp(1f, floor, t);
}
}
}