void FixedUpdate() { if (waitingForPlayers && Network.isServer) { waitingForPlayersTimeout = Mathf.Max(0, waitingForPlayersTimeout - Time.deltaTime); if (waitingForPlayersTimeout <= 0) { //Kick players not in yet foreach (ServerPlayer sp in client.GetPlayerList()) { if (!sp.ready) { client.networkView.RPC("Kick", sp.player, "Timed out on level load. (Did you alt+tab out of fullscreen?)"); Network.CloseConnection(sp.player, true); } } client.networkView.RPC("SetAllReady", RPCMode.All, true); } if (client.EveryoneIsReady()) { waitingForPlayers = false; client.networkView.RPC("LoadRace", RPCMode.All, settings.ToString()); RandomTexture rt = FindObjectOfType <RandomTexture>(); if (rt != null) { client.networkView.RPC("SyncSign", RPCMode.Others, rt.GetCurrentTexture()); } } } }
void setupPlayingField() { GameObject playingField = GameObject.Find("/Playing Field"); groundPlane = GameObject.Find("/Playing Field/Ground Plane"); collisionManager.groundPlane = groundPlane; ring = playingField.GetComponentInChildren <RingOut>(); patternShuffle = playingField.GetComponentInChildren <RandomTexture>(); }
void SyncSign(int textureID) { RandomTexture rt = FindObjectOfType <RandomTexture>(); if (rt != null && !Network.isServer) { rt.SetTexture(textureID); } }