コード例 #1
0
    public void fireGun() //shamelessly lifted from playerscript hee hee
    {
        ammoCount--;
        Quaternion recoilVector = new Quaternion();

        recoilVector.eulerAngles = new Vector3(handVisual.rotation.eulerAngles.x + Random.Range(-recoilIntensity * 1.5f, 0), handVisual.rotation.eulerAngles.y + Random.Range(-recoilIntensity, recoilIntensity) * 0.75f, handVisual.rotation.eulerAngles.z); //f**k this
        handVisual.rotation      = recoilVector;
        recoilIntensity         += recoilAdd;
        muzzleFlash.Play();
        shoot.fireABullet(bulletFirePoint.position, bulletFirePoint.forward, false);
    }
コード例 #2
0
    public void fireGun()
    {
        AmmoCount--;
        ammoSlider.value = AmmoCount;
        Quaternion recoilVector = new Quaternion();

        recoilVector.eulerAngles = new Vector3(handVisual.rotation.eulerAngles.x + Random.Range(-recoilIntensity * 1.5f, 0), handVisual.rotation.eulerAngles.y + Random.Range(-recoilIntensity, recoilIntensity) * 0.75f, handVisual.rotation.eulerAngles.z); //f**k this
        handVisual.rotation      = recoilVector;
        recoilIntensity         += recoilAdd;
        if (!silencer.activeSelf)
        {
            muzzleFlash.Play();
            muzzleFlashLight.range = 10;
            shoot.fireABullet(bulletFirePoint.position, bulletFirePoint.forward, false);
            makeSoundSphere(100f, .1f, bulletFirePoint.position);
        }
        else
        {
            muzzleFlashLight.range = 0;
            shoot.fireABullet(bulletFirePoint.position, bulletFirePoint.forward, false);
            makeSoundSphere(10f, .1f, bulletFirePoint.position);
        }
    }