public override void OnStartClient() { base.OnStartClient(); if (!isServer) { NetworkGameManager.AddPlayer(gameObject, playerNumber, color, playerName); } GameObject m_TankRenderers = transform.Find("TankRenderers").gameObject; // Get all of the renderers of the tank. Renderer[] renderers = m_TankRenderers.GetComponentsInChildren <Renderer>(); // Go through all the renderers... for (int i = 0; i < renderers.Length; i++) { // ... set their material color to the color specific to this tank. renderers[i].material.color = color; } if (m_TankRenderers) { m_TankRenderers.SetActive(false); } nameTag.text = "<color=#" + ColorUtility.ToHtmlStringRGB(color) + ">" + playerName + "</color>"; }
public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { if (lobbyPlayer == null) { return; } Prototype.NetworkLobby.LobbyPlayer lp = lobbyPlayer.GetComponent <Prototype.NetworkLobby.LobbyPlayer>(); if (lp != null) { NetworkGameManager.AddPlayer(gamePlayer, lp.slot, lp.playerColor, lp.nameInput.text); } }