Example #1
0
    void Update()
    {
        if (wepInHand != null && !GetComponentInParent <UIControlling>().GetInInventory())
        {
            if (wepInHand.GetIsShooting())
            {
                timeElapsed = wepInHand.CheckDelay(timeElapsed);
            }
            else if (Input.GetButton("Fire1") && !isReloading)
            {
                wepInHand.SetIsShooting(true);
                timeElapsed = 0f;
                PlayerShot();
            }

            if (Input.GetKeyDown(KeyCode.R) && !isReloading && !wepInHand.ClipIsFool())
            {
                if (wepInHand.HasAmmo())
                {
                    isReloading = true;
                    audReloading.Play();
                }
            }
            else if (isReloading && !audReloading.isPlaying)
            {
                wepInHand.Reloading();
                isReloading  = false;
                magText.text = wepInHand.TotalPlusMag();
            }
        }
    }
Example #2
0
 public void WeaponSwitched(WeaponProp wep)
 {
     wepInHand    = wep;
     emptyMag     = wepInHand.emptyMag;
     audShoot     = wepInHand.audShoot;
     audReloading = wepInHand.audReloading;
     magText.text = wepInHand.TotalPlusMag();
 }