public virtual void Shoot(Vector3 aimPosition, bool applyHipfirePrecision = false) { if (isShooting) { return; } if (rWeapon.ammoCount > 0) { var _aimPos = applyHipfirePrecision ? aimPosition + HipFirePrecision(aimPosition) : aimPosition; rWeapon.ShootEffect(_aimPos, transform); if (applyRecoilToCamera) { var recoilHorizontal = Random.Range(rWeapon.recoilLeft, rWeapon.recoilRight); var recoilUp = Random.Range(0, rWeapon.recoilUp); StartCoroutine(Recoil(recoilHorizontal, recoilUp)); } if (useAmmoDisplay && !ammoDisplay) { ammoDisplay = FindObjectOfType <vAmmoDisplay>(); } if (useAmmoDisplay && ammoDisplay) { ammoDisplay.UpdateDisplay(string.Format("{0} / {1}", rWeapon.ammoCount, totalAmmo), rWeapon.ammoID); } } else { rWeapon.EmptyClipEffect(); } currentShotTime = rWeapon.shootFrequency; }
public virtual void Shoot(Vector3 aimPosition) { if (rWeapon.ammoCount > 0) { shotting = true; rWeapon.ShootEffect(aimPosition, transform); if (applyRecoilToCamera) { var recoilHorizontal = Random.Range(rWeapon.recoilLeft, rWeapon.recoilRight); var recoilUp = Random.Range(0, rWeapon.recoilUp); StartCoroutine(Recoil(recoilHorizontal, recoilUp)); } if (animator) { animator.SetTrigger("Shoot"); } StartCoroutine(ResetShot(rWeapon.shootFrequency)); if (useAmmoDisplay && !ammoDisplay) { ammoDisplay = FindObjectOfType <vAmmoDisplay>(); } if (useAmmoDisplay && ammoDisplay) { ammoDisplay.UpdateDisplay(string.Format("{0} / {1}", rWeapon.ammoCount, totalAmmo), rWeapon.ammoID); } } else { shotting = true; rWeapon.EmptyClipEffect(); StartCoroutine(ResetShot(rWeapon.shootFrequency)); } }