public override void OnReady() { // Retrieve player information GhopperPlayer[] gPlayers = GetPlayers(); numPlayers = gPlayers.Length; Camera.main.transform.Rotate(0, 0, -180 / numPlayers); // Rotate camera to match board orientation with bezel boardObject.renderer.material = boardMaterials[numPlayers-2]; // Select board based on number of players // Game parameters initialization playerScores = new int[numPlayers]; players = new Player[numPlayers]; scoreBezel = new PlayerScoreBezel(numPlayers); clock = clockObject.GetComponent<Clock>(); // Player info generation Color colorRed = new Color (1.0f, 0.2f, 0.2f); Color colorBlue = new Color (0.3f, 0.3f, 1.0f); Color colorGreen = new Color (0.3f, 1.0f, 0.3f); Color colorYellow = new Color (1.0f,0.72f, 0.3f); Color colorPurple = new Color (0.5f, 0.1f, 0.4f); Color colorCyan = new Color(0.0f, 0.9f, 0.9f); Color[] playerColors = {colorRed, colorBlue, colorGreen, colorYellow, colorPurple, colorCyan}; string[] playerNames = {"Red", "Blue", "Green", "Yellow", "Purple", "Cyan"}; // Player info initialization for (int i = 0; i < numPlayers; ++i) { playerScores[i] = 0; GameObject playerObject = (GameObject)GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity); players[i] = playerObject.GetComponent<Player>(); players[i].InitPlayerInfo(i, playerColors[i], playerMaterials[i], ballMaterials[i], GetBallSpawnPos(i)); scoreBezel.SetPlayerName(i, playerNames[i]); scoreBezel.SetPlayerColor(i, playerColors[i]); scoreBezel.SetPlayerScore(i, playerScores[i]); } // Initialize Bezel bezel.LoadTemplate(scoreBezel); //scoreBezel.Show(); SpawnBall(GetBallSpawnPos(0)); // Spawn a ball at player one's position clock.SetGoalSpawnPos(GetBallSpawnPos(0)); // Initialize clock's spawn position, in case the ball disappears before a goal is scored, it has a place to spawn again SpawnBumpers(); SpawnPegs(); // Add touch input listeners InputMaster.WorldTouchStarted += TouchStarted; InputMaster.WorldTouchUpdate += TouchUpdate; InputMaster.WorldTouchEnded += TouchEnded; Show(); }