Ejemplo n.º 1
0
    internal void LaunchBall(BallType type, float force)
    {
        var ball = Instantiate(_ballsByType[type]);

        ball.transform.position = launchPoint.position;

        ball.Launch(force * launchForceMultiply);
        OnBallLaunched?.Invoke(ball);
    }
Ejemplo n.º 2
0
 public void Launch(Vector3 velocity)
 {
     if (this.InPlay)
     {
         return;
     }
     InPlay             = true;
     this._audio.pitch  = velocity.z / 1300;
     this._audio.volume = 1300 / 2 / velocity.z;
     this._audio.Play();
     this._rigidbody.useGravity = true;
     this._rigidbody.velocity   = velocity;
     OnBallLaunched.Invoke(this);
 }