// Assets/_Project/Scripts/Gameplay/EnemyAbilities/EnemySpawnContext.cs
namespace TD.Gameplay.EnemyAbilities
{
///
/// Mutable per-spawn copy of an enemy's stats, handed to each of its abilities before the
/// enemy is built so they can alter what it spawns as.
///
///
/// Why a context rather than more parameters. Wave buffs like "grounded enemies become
/// flying" or "enemies spawn at half health" have to land before
/// EnemyHealth.InitializeServer and before the spawn position is computed (flyers are
/// raised by their flight height). Threading each new stat through SpawnEnemy as another
/// argument was already unwieldy at two; this keeps the signature flat and gives abilities one
/// obvious place to write.
///
/// Seeded from the , never written back to it — the
/// definition is a shared asset and a buff that mutated it would leak across waves, matches,
/// and (in the editor) sessions.
///
public struct EnemySpawnContext
{
public float MaxHp;
public float MoveSpeed;
public bool IsFlying;
public float FlightHeight;
public int LivesCost;
/// Uniform transform scale relative to the prefab's authored scale.
public float VisualScale;
/// Seeds a context from an enemy definition's authored stats.
public static EnemySpawnContext FromDefinition(EnemyDefinition def) => new EnemySpawnContext
{
MaxHp = def.MaxHp,
MoveSpeed = def.MoveSpeed,
IsFlying = def.IsFlying,
FlightHeight = def.FlightHeight,
LivesCost = def.LivesCost,
VisualScale = 1f,
};
}
}