Esempio n. 1
0
    void ApplyRecoil(float overTime)
    {
        GunObject gun = gunHandler.gun;

        float aimAdjust = (isAiming()) ? gun.aimDownMultiplier : 1f;

        Vector3 shotRecoil = Vector3.zero;

        if (gun.shooting == GunObject.ShootType.auto)
        {
            shotRecoil = gun.recoil.GetRecoil(continuousShots, gun.ammoClip, gun.cyclesInClip);
        }
        else if (gun.shooting == GunObject.ShootType.burst)
        {
            shotRecoil = gun.recoil.GetRecoil(continuousShots, gun.burstShot, 1);
        }
        else if (gun.shooting == GunObject.ShootType.semi)
        {
            shotRecoil = gun.recoil.GetRecoil(continuousShots, semiCalculations);
        }

        shotRecoil *= aimAdjust;
        cameraMovement.AddRecoil(shotRecoil, overTime);

        shotRecoil.y = 0;
        float z = shotRecoil.z;

        shotRecoil.x  = gun.recoil.xRecoil.EvaluteValue(Random.Range(0.0f, 1.0f));
        shotRecoil.x *= aimAdjust;
        shotRecoil   *= overTime;
        shotRecoil.z  = z;

        GunRecoil(shotRecoil, overTime);
    }