Question by
YoloJoe · Feb 09, 2016 at 04:25 PM ·
ammogun script
How can I add ammo to my gun script?
Here it is:
if (Input.GetButton (PlayerInput.Fire1) && _fireCounter > fireDelay)
{
muzzle.GetComponent<AudioSource>().Play ();
muzzle.GetComponent<ParticleSystem>().Play ();
_fireCounter = 0f;
RaycastHit hit;
if (_playerController.aim) {
if (Physics.Raycast (_ray, out hit, 100f))
{
Instantiate (bulletHole, hit.point, Quaternion.FromToRotation (Vector3.up, hit.normal));
}
} else
{
if (Physics.Raycast (muzzle.position, muzzle.forward, out hit, 100f))
{
Instantiate (bulletHole, hit.point, Quaternion.FromToRotation (Vector3.up, hit.normal));
}
}
StartCoroutine (MuzzleFlash ());
}
Comment