Adding Match State controller

This commit is contained in:
Matt F 2026-05-12 10:31:23 -07:00
parent c100db52e5
commit abcefcd7f1
13 changed files with 445 additions and 99 deletions

View file

@ -400,21 +400,7 @@ namespace TD.Gameplay
// ----- Player slot ------------------------------------------------
/// <summary>
/// Returns the local player's PlayerSlot.
/// STUB: Uses the same trivial client-ID → slot mapping as
/// <c>TowerPlacementManager.ClientIdToPlayerSlot</c>. Will be replaced
/// when MatchState carries the authoritative assignment.
/// </summary>
private static PlayerSlot GetLocalPlayerSlot()
{
var nm = Unity.Netcode.NetworkManager.Singleton;
if (nm == null || !nm.IsClient) return PlayerSlot.None;
ulong clientId = nm.LocalClientId;
byte slotByte = (byte)(clientId + 1);
if (slotByte < 1 || slotByte > 9) return PlayerSlot.None;
return (PlayerSlot)slotByte;
}
=> PlayerMatchState.Local?.Slot ?? PlayerSlot.None;
}
}