// Token: 0x06000F00 RID: 3840 RVA: 0x00063728 File Offset: 0x00061928
    protected override bool OnPlayerPickup()
    {
        bool flag = AmmoDepot.CanAddAmmo(this._ammoType);

        if (flag)
        {
            AmmoDepot.AddDefaultAmmoOfType(this._ammoType);
            switch (this._ammoType)
            {
            case AmmoType.Cannon:
                GameData.Instance.OnItemPickup.Fire("Cannon Rockets", PickUpMessageType.AmmoCannon);
                break;

            case AmmoType.Handgun:
                GameData.Instance.OnItemPickup.Fire("Handgun Rounds", PickUpMessageType.AmmoHandgun);
                break;

            case AmmoType.Launcher:
                GameData.Instance.OnItemPickup.Fire("Launcher Grenades", PickUpMessageType.AmmoLauncher);
                break;

            case AmmoType.Machinegun:
                GameData.Instance.OnItemPickup.Fire("Machinegun Ammo", PickUpMessageType.AmmoMachinegun);
                break;

            case AmmoType.Shotgun:
                GameData.Instance.OnItemPickup.Fire("Shotgun Shells", PickUpMessageType.AmmoShotgun);
                break;

            case AmmoType.Snipergun:
                GameData.Instance.OnItemPickup.Fire("Sniper Bullets", PickUpMessageType.AmmoSnipergun);
                break;

            case AmmoType.Splattergun:
                GameData.Instance.OnItemPickup.Fire("Splattergun Cells", PickUpMessageType.AmmoSplattergun);
                break;
            }
            base.PlayLocalPickupSound(GameAudio.AmmoPickup2D);
            UberstrikeItemClass uberstrikeItemClass;
            if (AmmoDepot.TryGetAmmoTypeFromItemClass(this._ammoType, out uberstrikeItemClass))
            {
                GameState.Current.Actions.PickupPowerup(base.PickupID, PickupItemType.Ammo, (int)((byte)uberstrikeItemClass));
            }
            if (GameState.Current.IsSinglePlayer)
            {
                base.StartCoroutine(base.StartHidingPickupForSeconds(this._respawnTime));
            }
        }
        return(flag);
    }
Пример #2
0
    // Token: 0x06001DF9 RID: 7673 RVA: 0x00094088 File Offset: 0x00092288
    public static bool CanAddAmmo(AmmoType t)
    {
        UberstrikeItemClass itemClass;

        return(AmmoDepot.TryGetAmmoTypeFromItemClass(t, out itemClass) && Singleton <WeaponController> .Instance.HasWeaponOfClass(itemClass) && AmmoDepot._currentAmmo[t] < AmmoDepot._maxAmmo[t]);
    }