void Awake() { _weaponAmmo = transform.GetComponent <WeaponAmmo>(); _controller = GetComponentInParent <SteamVR_TrackedController>(); _controller.TriggerClicked += (sender, eventArgs) => TryFire(); _controller.Gripped += (sender, eventArgs) => _weaponAmmo.Reload(); _weaponAmmo.Reload(); }
IEnumerator Reload() { // Debug.Log("Reloading..."); animator.SetTrigger("Reload"); gunAudio.PlayOneShot(gunReload); isReloading = true; yield return(new WaitForSeconds(reloadTime)); ammo.Reload(); // Debug.Log("Finished reload"); isReloading = false; }