protected override void SetupBall(int index) { // Retrieve the proper position of the ball according to the provided index Vector3 position = Utils.GetBallPosition(index, true); // Create the ball Transform ts_Ball = Instantiate(this.go_Ball.transform, position, Quaternion.identity); Ball ball = ts_Ball.GetComponent <Ball>(); // Attach the ball to the opponent row parent ball.transform.parent = this.transform; // Select a random color int random_index = Random.Range(0, 8); BallManager.Color color = BallManager.GetColor(random_index); // Setup the ball ball.SetIndex(index); ball.SetColor(color); ball.SetParentRow(this); ball.SetIsOpponent(true); // Add the current ball to the record this.m_balls.Add(ball); }
/** * Set the ball material color */ private void SetMaterialColor() { this.m_mat.color = BallManager.GetColor(this.m_color); }