void SpawnBall() { Vector2 ballSpawnPos = new Vector2(Random.Range(-2.25f, 2.25f), -6); NewBall ball = Instantiate(m_BallPrefab); ball.transform.position = ballSpawnPos; ball.m_Launching = true; ball.canBeCaught = false; ball.GetComponent <Rigidbody2D>().velocity = Vector2.up * ballLaunchForce; ball.GetComponentInChildren <NewBallArtManager>().SetInfo(_ballCount); balls.Add(ball); _ballCount++; ballsSortedByDepth.Add(ball.GetComponent <NewBallArtManager>()); }
public void SpawnFirstBall() { if (firstBall) { return; } Vector2 ballSpawnPos = new Vector2(0, -2); NewBall ball = Instantiate(m_BallPrefab); ball.transform.position = ballSpawnPos; ball.m_Launching = false; ball.canBeCaught = false; ball.GetComponent <Rigidbody2D>().velocity = Vector2.zero; ball.GetComponent <Rigidbody2D>().gravityScale = 0; ball.GetComponentInChildren <NewBallArtManager>().SetInfo(_ballCount); firstBall = ball; balls.Add(ball); _ballCount++; NewScoreManager._numBalls = _ballCount; ballsSortedByDepth.Add(ball.GetComponent <NewBallArtManager>()); }