Example #1
0
 public void TryReloadEquippedItem()
 {
     if (this._equippedItem != null)
     {
         C_AmmoOnGun component = this._equippedItem.GetComponent <C_AmmoOnGun>();
         // SUPERGUN check
         if (God.Settings.Supergun)
         {
             component.Reload(component.MaximumClipSize, true);
         }
         if (component == null)
         {
             return;
         }
         if (component._currentAmmo == component.MaximumClipSize)
         {
             return;
         }
         if (component._isReloading)
         {
             return;
         }
         if (component != null)
         {
             if (God.Settings.InfiniteAmmo)
             {
                 component.Reload(component.MaximumClipSize, true);
             }
             else
             {
                 int num = this.CountAmmoInInventory();
                 if (num > 0)
                 {
                     component.Reload(num, true);
                     if (component.ReloadSound != null)
                     {
                         this.PlaySound(component.ReloadSound, base.transform.position);
                     }
                     this.m_pC_FPSPlayer.Reload();
                     this.m_ReloadStateSet = true;
                     return;
                 }
                 if (component.NoAmmoSound != null)
                 {
                     this.PlaySound(component.NoAmmoSound, base.transform.position);
                 }
             }
         }
     }
 }
Example #2
0
 public void DoneReloadEquippedItem()
 {
     if (this._equippedItem != null)
     {
         C_AmmoOnGun component = this._equippedItem.GetComponent <C_AmmoOnGun>();
         if (component == null)
         {
             return;
         }
         if (component._currentAmmo == component.MaximumClipSize)
         {
             return;
         }
         if (component != null)
         {
             // SUPERGUN Check
             if (God.Settings.InfiniteAmmo || God.Settings.Supergun)
             {
                 component.Reload(component.MaximumClipSize, true);
             }
             else
             {
                 int num = this.UpdateAmmoInInventory();
                 if (num > 0)
                 {
                     component._currentAmmo += num;
                     if (component._currentAmmo > component.MaximumClipSize)
                     {
                         component._currentAmmo = component.MaximumClipSize;
                     }
                     return;
                 }
                 this.PlaySound(component.NoAmmoSound, base.transform.position);
             }
         }
     }
 }