Adding Match State controller
This commit is contained in:
parent
c100db52e5
commit
abcefcd7f1
13 changed files with 445 additions and 99 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue