public void UnregisterPlayer(string playerId) { // Stop tracking player and remove status UI players.Remove(playerId); UIPlayerInfoController infoController = infoControllers[playerId]; infoControllers.Remove(playerId); if (infoController != null) { Destroy(infoController.gameObject); } }
public void RegisterPlayer(uint netId, Player player) { // Keep track of all players using their name string playerId = PLAYER_ID_PREFIX + netId; players.Add(playerId, player); player.transform.name = playerId; // Show player information in UI UIPlayerInfoController infoController = Instantiate( playerInfoControllerPrefab, playerInfoList ); infoController.SetInfo(playerId, player.hitsTaken); // Keep track of the player status UI infoControllers.Add(playerId, infoController); }