public void Reload() { if (!isReloading && (pocketAmmo > 0) && (currentAmmo < (magCapacity + 1))) { isReloading = true; lastReloadTime = Time.time; if (PlayerPrefs.GetInt(PlayerPrefKey.IS_AUDIO_ENABLE) > 0) { AudioSource.PlayClipAtPoint(reloadSound, transform.position, 0.8f); } magParticle.EmitCount(1); } }
public void PullTrigger() { if (!isReloading && (currentAmmo <= 0) && isReady) { if (PlayerPrefs.GetInt(PlayerPrefKey.IS_AUDIO_ENABLE) > 0) { AudioSource.PlayClipAtPoint(emptySound, transform.position); } isReady = false; } else if (!isReloading && (currentAmmo > 0) && ((Time.time - lastShotTime) >= timeBetweenShot)) { Instantiate(bullet, transform.position, Quaternion.Euler(0, 0, transform.eulerAngles.z)); bulletShellParticle.EmitCount(1); currentAmmo--; lastShotTime = Time.time; if (PlayerPrefs.GetInt(PlayerPrefKey.IS_AUDIO_ENABLE) > 0) { AudioSource.PlayClipAtPoint(fireSound, transform.position, 0.16f); } } }