Пример #1
0
 public void LaunchBall() //Launch ball to play
 {
     if (isBallReady)
     {
         isBallReady = !isBallReady;
         BallController bc = ball.GetComponent <BallController>();
         Rigidbody      rb = ball.GetComponent <Rigidbody>();
         rb.isKinematic = false;
         bc.velocity    = new Vector2(Random.Range(1.0f, 4.0f), Random.Range(-4.0f, 4.0f));
         float multiplier = bc.velocity.magnitude / baseBallSpeed;
         bc.velocity = new Vector2(bc.velocity.x / multiplier, bc.velocity.y / multiplier);
         bc.speed    = baseBallSpeed;
         bc.CheckWall();
     }
 }