// Assets/_Project/Scripts/Gameplay/RaceDefinition.cs using UnityEngine; using TD.Core; using TD.Towers; namespace TD.Gameplay { /// /// One asset per playable race. Holds the race's identity (the /// binding for networked selection), the visual + lore /// content shown in the lobby's race-selection UI, and stub fields for the /// Phase 1.8 gameplay payload (race-specific builder + tower roster). /// /// /// Creating a new race. Right-click in the project window → /// Create → TD → Race Definition. Fill in the inspector: /// /// Id — pick an unused value (Race1..Race16). /// Display Name — what shows in the grid + detail header. /// Icon — square sprite, ~256x256, drawn in the grid + detail. /// Builder Name / Description — text in the detail panel. /// Lore Text — longer description in the detail panel. /// Builder Prefab / Towersstubs, wired in Phase 1.8. /// /// Then drag the asset into the RaceRegistry's Definitions /// array on the scene's RaceRegistry GameObject. /// /// Why is serialized rather than inferred from the /// asset name. Race selection is networked via a /// -backed enum on /// PlayerMatchState. The enum byte value is the wire identity; the /// asset is just the local lookup. Keeping the binding explicit on the /// asset prevents accidental drift if assets get renamed. /// [CreateAssetMenu(fileName = "RaceDefinition", menuName = "TD/Race Definition", order = 5)] public class RaceDefinition : ScriptableObject { [Header("Identity")] [Tooltip("Enum value used by PlayerMatchState.RaceSelection on the network. " + "Pick an unused RaceId (Race1..Race16). Each asset must use a unique value.")] public RaceId Id = RaceId.None; [Tooltip("Race name shown in the lobby grid and detail panel header.")] public string DisplayName; [Tooltip("Square icon shown in the grid cell and as the larger image in the detail panel. " + "~256x256 PNG works well; the UI scales to fit.")] public Sprite Icon; [Header("Builder")] [Tooltip("Builder name shown in the detail panel (the builder is the in-match avatar " + "that gates tower placement by proximity).")] public string BuilderName; [Tooltip("Short description of the builder shown beneath the name in the detail panel.")] [TextArea(2, 4)] public string BuilderDescription; [Header("Lore")] [Tooltip("Race lore / background shown in the detail panel. Lorem ipsum is fine " + "for placeholder races; replace when actual writing is ready.")] [TextArea(5, 15)] public string LoreText; [Header("Gameplay payload (Phase 1.8 — not wired yet)")] [Tooltip("STUB (Phase 1.8): race-specific builder prefab. Currently every race spawns " + "the default builder. When Phase 1.8 lands, PlayerBuilderSpawner will pick " + "the prefab based on the player's RaceSelection.")] public GameObject BuilderPrefab; [Tooltip("STUB (Phase 1.8): tower roster available to this race. TowerRegistry will " + "filter to this list when the active player belongs to this race.")] public TowerDefinition[] Towers; } }