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>
53 lines
2.4 KiB
C#
53 lines
2.4 KiB
C#
// Assets/_Project/Scripts/Gameplay/EnemyAbilities/FlightAbilityDefinition.cs
|
|
using UnityEngine;
|
|
using TD.Core;
|
|
|
|
namespace TD.Gameplay.EnemyAbilities
|
|
{
|
|
/// <summary>
|
|
/// Grounded enemies take to the air: they path over the baked terrain grid instead of through
|
|
/// the maze, and towers flagged ground-only can no longer touch them.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <b>The single most punishing card in the set</b>, because it doesn't weaken the maze — it
|
|
/// deletes it. Everything a player built to lengthen the route stops mattering for that wave,
|
|
/// and only their anti-air coverage counts. Weight it accordingly in the pools.
|
|
///
|
|
/// <para>Purely a spawn-time change: <c>EnemyMovement</c> reads the flying flag once at
|
|
/// initialization to pick which grid to path on and to opt out of re-path scheduling, and
|
|
/// <c>TowerCombat</c> reads the replicated flag on <c>EnemyHealth</c> when filtering targets.
|
|
/// Both are already wired for flight — this card only has to flip the bit before the enemy is
|
|
/// built.</para>
|
|
/// </remarks>
|
|
[CreateAssetMenu(fileName = "FlightAbility", menuName = "TD/Enemy Abilities/Flight")]
|
|
public class FlightAbilityDefinition : EnemyAbilityDefinition
|
|
{
|
|
public override EnemyAbilityKind Kind => EnemyAbilityKind.Flight;
|
|
|
|
[Header("Flight")]
|
|
[Tooltip("Height above the ground these enemies hover at. Keep modest — tower targeting " +
|
|
"uses 3D range, so altitude eats into the effective reach of anything that CAN " +
|
|
"shoot them.")]
|
|
[Min(0f)]
|
|
public float FlightHeight = 3f;
|
|
|
|
[Tooltip("Speed multiplier applied when the enemy takes flight. Flying enemies travel a " +
|
|
"much shorter route, so values below 1 are a reasonable counterweight.")]
|
|
[Range(0.1f, 2f)]
|
|
public float SpeedMultiplier = 1f;
|
|
|
|
public override void ServerModifySpawn(ref EnemySpawnContext context)
|
|
{
|
|
// Already-flying enemies keep their authored height rather than being overwritten by
|
|
// this card's — the wave was designed around it, and stacking Flight onto a flier
|
|
// shouldn't quietly relocate it.
|
|
if (!context.IsFlying)
|
|
{
|
|
context.IsFlying = true;
|
|
context.FlightHeight = FlightHeight;
|
|
}
|
|
|
|
context.MoveSpeed *= SpeedMultiplier;
|
|
}
|
|
}
|
|
}
|