Ball spawner

This method would be called when there's a need to spawn a new Ball in the game, such as at the start of a level or when a player makes a move that generates a new Ball. Use name of the prefab in parameter. Use SetPosition to put ball to the static position on the field.

Here's an example of how to use the BallPool to create a ball with a random color:

var ball = PoolObject.GetObject("Ball 0").GetComponent<Ball>();
ColorManager.instance.GenerateColorInGame());

// set position on the field
ball.SetPosition((col,row));

In this case, we're creating a new ball at position (0,0) with a random color. The color is determined by passing the integer equivalent of EBallColor.RandomColor to the SpawnBall method. This enum value tells the method to assign a random color to the ball.

Last updated