private void Fire() { m_Fired = true; m_Ball.GetComponent <Rigidbody>().isKinematic = false; m_Ball.GetComponent <Rigidbody>().detectCollisions = true; m_Ball.GetComponent <Rigidbody>().velocity = m_CurrentLaunchForce * m_FireTransform.forward; m_Ball.m_player = this; //m_ShootingAudio.clip = m_FireClip; //m_ShootingAudio.Play(); m_CurrentLaunchForce = m_MinLaunchForce; carrying = false; m_Ball = null; }
private void SpawnBall() { transform.position = new Vector3(Random.Range(xMinLeft, xMaxRight), yPos, 0); float ballsize = Random.Range(ballMinSize, ballMaxSize); BallPrefab.GetComponent <Transform>().localScale = new Vector3(ballsize, ballsize, 0); Instantiate(BallPrefab, transform.position, transform.rotation); }