Restructures the game around the cyclical run loop from Game Design Doc V2: 5 waves = a cycle, 3 cycles = a phase, each phase ends in a boss. - New TD.Gameplay.Waves: WaveGroup / PhaseDefinition / RunDefinition author the run as draggable weighted pools; RunState owns phase/cycle position, the drawn wave slots, and the per-slot enemy buff sets. WaveManager's flat wave array is gone -- it now only runs the encounter RunState points at. - New TD.Gameplay.EnemyUpgrades: the post-wave enemy-buff vote, with public live-replicated ballots so the HUD can show who voted for what. - Inter-wave flow is now strictly sequential: draft -> vote -> build, each stage ending early once every player has acted. - Enemy abilities inverted from per-instance random rolls to deterministic, stacking per-wave-slot sets. Six cards ship: Split (reworked), Flight, Blink, No Bounty, Gold Theft, Double Up. - Tower upgrades are a two-step tree: a draft pick unlocks a node, gold converts an already-placed tower in place. - Boss encounters flag their enemies and drive a boss HP bar. - Player cap reduced to 3 via MatchRules.MaxPlayers. - GoldConfig is now keyed by global encounter number rather than wave index. Compiles clean; NOT yet verified in-engine. Editor wiring still required -- see Docs/2.0_Setup_Checklist.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
42 lines
1.8 KiB
C#
42 lines
1.8 KiB
C#
// Assets/_Project/Scripts/Gameplay/EnemyAbilities/EnemySpawnContext.cs
|
|
namespace TD.Gameplay.EnemyAbilities
|
|
{
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <b>Why a context rather than more parameters.</b> Wave buffs like "grounded enemies become
|
|
/// flying" or "enemies spawn at half health" have to land <i>before</i>
|
|
/// <c>EnemyHealth.InitializeServer</c> and before the spawn position is computed (flyers are
|
|
/// raised by their flight height). Threading each new stat through <c>SpawnEnemy</c> as another
|
|
/// argument was already unwieldy at two; this keeps the signature flat and gives abilities one
|
|
/// obvious place to write.
|
|
///
|
|
/// <para>Seeded from the <see cref="EnemyDefinition"/>, 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.</para>
|
|
/// </remarks>
|
|
public struct EnemySpawnContext
|
|
{
|
|
public float MaxHp;
|
|
public float MoveSpeed;
|
|
public bool IsFlying;
|
|
public float FlightHeight;
|
|
public int LivesCost;
|
|
|
|
/// <summary>Uniform transform scale relative to the prefab's authored scale.</summary>
|
|
public float VisualScale;
|
|
|
|
/// <summary>Seeds a context from an enemy definition's authored stats.</summary>
|
|
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,
|
|
};
|
|
}
|
|
}
|