GameStateBehaviour.OnHitShotGunRing C# (CSharp) Method

OnHitShotGunRing() private method

private OnHitShotGunRing ( ) : void
return void
	private void OnHitShotGunRing () {
	
		for (int i = 0; i < 4; i ++) {
		
			GameObject ringBall = PhotonNetwork.Instantiate ("Ball", Ball.transform.position, Quaternion.identity, 0);
			ringBalls.Add (ringBall);

			ringBall.transform.parent = BoardwalkPong.transform;
			Vector3 velocity = Ball.GetComponent <Rigidbody> ().velocity;
			Vector3 angleDiff = new Vector3 (Random.Range (-15f, 15f), Random.Range (-15f, 15f), 0);
			Quaternion rotation = Quaternion.Euler (angleDiff);

			ringBall.transform.position = Ball.transform.position;
			Vector3 rotatedVelocity = rotation * velocity;
			ringBall.transform.position += rotatedVelocity.normalized * ringBall.GetComponent<Renderer> ().bounds.size.x;
			Ball.GetComponent <Rigidbody> ().velocity = rotatedVelocity.normalized * velocity.magnitude;
		}
	}