/// <summary> /// Creates an instance of a ball object and gives it an initial velocity. /// </summary> public void CreateBall() { if (currentNumberOfBalls < maxNumberOfBalls) { Rigidbody newBallInstance = ballManager.CreateNewBall(fireTransform.position, fireTransform.rotation); newBallInstance.velocity = ballSpeed * fireTransform.forward; } }
/// <summary> /// Creates an instance of a ball object and gives it an initial velocity /// </summary> void CreateBall() { if ((currentNumberOfBalls < maxNumberOfBalls) && (isPlayerWithinRange == true) && (playerHealth.currentHealth > 0)) { Rigidbody newBallInstance = ballManager.CreateNewBall(fireTransform.position, fireTransform.rotation); newBallInstance.velocity = ballSpeed * fireTransform.forward; BallStates ballStateInstance = newBallInstance.gameObject.GetComponent <BallStates>(); ballStateInstance.ChangeBallState(2); } }