Adding HUD!

This commit is contained in:
Matt F 2026-05-08 21:40:15 -07:00
parent ff62b1e9f1
commit f7720a9915
20 changed files with 1482 additions and 92 deletions

View file

@ -594,6 +594,22 @@ namespace TD.Gameplay
return TryGetDefinition(typeId, out var def) ? def : null;
}
/// <summary>
/// Enumerates all valid (definition, typeId) pairs from the current definition list.
/// TypeId 0 is reserved; valid entries start at index 1. Used by the HUD command grid
/// to populate tower buttons. Only meaningful on the instance — check Instance != null
/// before calling.
/// </summary>
public System.Collections.Generic.IEnumerable<(TowerDefinition def, int typeId)>
GetAvailableDefinitions()
{
for (int i = 1; i < towerDefinitions.Length; i++)
{
if (towerDefinitions[i] != null)
yield return (towerDefinitions[i], i);
}
}
/// <summary>
/// Maps a client ID to the PlayerSlot assigned to that client.
/// </summary>