First pass at full refactor to 2.0 design
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>
This commit is contained in:
parent
7e5c3a8279
commit
4892d7253d
64 changed files with 4023 additions and 344 deletions
|
|
@ -0,0 +1,75 @@
|
|||
// Assets/_Project/Scripts/Gameplay/EnemyUpgrades/EnemyUpgradeGroup.cs
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TD.Core;
|
||||
|
||||
namespace TD.Gameplay.EnemyUpgrades
|
||||
{
|
||||
/// <summary>
|
||||
/// One weighted candidate inside an <see cref="EnemyUpgradeGroup"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Weight is relative and normalized at draw time — see <see cref="PoolWeightAttribute"/>.
|
||||
/// Kept on the entry rather than on the option asset for the same reason wave weights are:
|
||||
/// a card can be a staple of one phase's pool and a rarity in another's.
|
||||
/// </remarks>
|
||||
[Serializable]
|
||||
public class EnemyUpgradePoolEntry
|
||||
{
|
||||
[Tooltip("The enemy-buff card that may be offered from this group.")]
|
||||
public EnemyUpgradeOption Option;
|
||||
|
||||
[Tooltip("Relative draw weight within the pool this group contributes to. Entries at " +
|
||||
"equal weight are equally likely; 0.5 is half as likely as 1.0.")]
|
||||
[PoolWeight("buff")]
|
||||
public float Weight = 1f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A named, reusable bag of enemy-buff cards. Groups are the unit designers move between
|
||||
/// phases: dragging a group into Phase 2's list makes every card in it votable from phase 2
|
||||
/// onward, without touching the cards themselves.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Buffs are gated by <b>phase</b>, not by cycle — every card a phase allows is votable from
|
||||
/// its very first wave. Gating by cycle was considered and rejected: the whole point of the
|
||||
/// cyclical structure is that players choose how hard to make their own next lap, and holding
|
||||
/// the interesting cards back until cycle 3 would flatten that decision into a formality.
|
||||
/// </remarks>
|
||||
[CreateAssetMenu(fileName = "EnemyUpgradeGroup",
|
||||
menuName = "TD/Enemy Upgrades/Upgrade Group", order = 21)]
|
||||
public class EnemyUpgradeGroup : ScriptableObject
|
||||
{
|
||||
[Tooltip("Designer-facing name, shown in validation messages. Falls back to the asset name.")]
|
||||
public string DisplayName;
|
||||
|
||||
[Tooltip("Cards in this group, each with a relative draw weight.")]
|
||||
public EnemyUpgradePoolEntry[] Options;
|
||||
|
||||
/// <summary>Name used in validation and log messages. Falls back to the asset name.</summary>
|
||||
public string Label => string.IsNullOrWhiteSpace(DisplayName) ? name : DisplayName;
|
||||
|
||||
/// <summary>
|
||||
/// Appends every non-null, non-zero-weight entry across <paramref name="groups"/> into
|
||||
/// <paramref name="into"/>. Zero-weight entries are filtered here so "weight 0 means it
|
||||
/// can never appear" lives in exactly one place.
|
||||
/// </summary>
|
||||
public static void CollectCandidates(EnemyUpgradeGroup[] groups, List<EnemyUpgradePoolEntry> into)
|
||||
{
|
||||
into.Clear();
|
||||
if (groups == null) return;
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
if (group?.Options == null) continue;
|
||||
foreach (var entry in group.Options)
|
||||
{
|
||||
if (entry?.Option == null) continue;
|
||||
if (entry.Weight <= 0f) continue;
|
||||
into.Add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue