// Remove last added client void RemoveClient() { if (backgroundGames.Count > 0) { GameObject removedClient = backgroundGames.Dequeue(); DemoGUI.GetGameLogic(removedClient).Disconnect(); Destroy(removedClient); } }
/// <summary> /// Check if local player has joined the game /// </summary> /// <returns></returns> private bool LocalPlayerJoined() { GameLogic localPlayerGameLogic = DemoGUI.GetGameLogic("Local Player"); if (localPlayerGameLogic.State == ClientState.Joined && localPlayerGameLogic.LocalRoom != null && this.gameLogic.State == ClientState.Joined) { return(true); } return(false); }
// Set the playground texture // Current texture depends on interest management setting private void SetPlaygroundTexture() { GameObject playground = GameObject.Find("Playground"); Material playgroundMaterial; Texture texture; float textureScale; Material playgroundGridMaterial; Texture gridTexture; float gridTextureScale; Material[] materials; materials = playground.renderer.materials; playgroundMaterial = new Material(Shader.Find("Diffuse")); playgroundGridMaterial = new Material(Shader.Find("Transparent/Diffuse")); gridTexture = Resources.Load("interest management grid") as Texture; gridTextureScale = DemoGUI.GetGameLogic("Local Player").GridSize; playgroundGridMaterial.mainTexture = gridTexture; if (GetGameLogic("Local Player").UseInterestGroups) { texture = Resources.Load("interest groups enabled texture") as Texture; textureScale = 1.0f; materials[0] = playgroundMaterial; materials[0].mainTexture = texture; materials[0].mainTextureScale = new Vector2(textureScale, textureScale); } else { texture = Resources.Load("interest groups disabled texture") as Texture; textureScale = DemoGUI.GetGameLogic("Local Player").GridSize; materials[0] = playgroundMaterial; materials[0].mainTexture = texture; materials[0].mainTextureScale = new Vector2(textureScale, textureScale); } materials[1] = playgroundGridMaterial; materials[1].mainTexture = gridTexture; materials[1].mainTextureScale = new Vector2(gridTextureScale, gridTextureScale); texture.wrapMode = TextureWrapMode.Repeat; gridTexture.wrapMode = TextureWrapMode.Repeat; playground.renderer.materials = materials; }
// Check if the local player joined the game private bool IsLocalPlayerInGame() { return(DemoGUI.GetGameLogic("Local Player").LocalPlayer != null ? true : false); }