示例#1
0
 void Awake()
 {
     _weaponAmmo = transform.GetComponent <WeaponAmmo>();
     _controller = GetComponentInParent <SteamVR_TrackedController>();
     _controller.TriggerClicked += (sender, eventArgs) => TryFire();
     _controller.Gripped        += (sender, eventArgs) => _weaponAmmo.Reload();
     _weaponAmmo.Reload();
 }
示例#2
0
    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;
    }