Пример #1
0
        // Token: 0x060010F8 RID: 4344 RVA: 0x00067D80 File Offset: 0x00065F80
        private void SendAmmoIncrease()
        {
            switch (this._item._config.AmmoIncrease)
            {
            case IncreaseStyle.Absolute:
                foreach (object obj in Enum.GetValues(typeof(AmmoType)))
                {
                    AmmoType t = (AmmoType)((int)obj);
                    AmmoDepot.AddAmmoOfType(t, this._item._config.PointsGain);
                }
                break;

            case IncreaseStyle.PercentFromStart:
                foreach (object obj2 in Enum.GetValues(typeof(AmmoType)))
                {
                    AmmoType t2 = (AmmoType)((int)obj2);
                    AmmoDepot.AddStartAmmoOfType(t2, (float)this._item._config.PointsGain / 100f);
                }
                break;

            case IncreaseStyle.PercentFromMax:
                foreach (object obj3 in Enum.GetValues(typeof(AmmoType)))
                {
                    AmmoType t3 = (AmmoType)((int)obj3);
                    AmmoDepot.AddMaxAmmoOfType(t3, (float)this._item._config.PointsGain / 100f);
                }
                break;

            default:
                throw new NotImplementedException("SendAmmoIncrease for type: " + this._item._config.AmmoIncrease);
            }
        }
Пример #2
0
 // Token: 0x06001F7F RID: 8063 RVA: 0x00014C31 File Offset: 0x00012E31
 public void Reset()
 {
     AmmoDepot.Reset();
     this._currentSlotID.SetRange(0, 3);
     this._currentSlot = null;
     this.ShowFirstWeapon();
 }
Пример #3
0
    // Token: 0x06001F7E RID: 8062 RVA: 0x000971EC File Offset: 0x000953EC
    public void InitializeAllWeapons(Transform attachPoint)
    {
        for (int i = 0; i < this._weapons.Length; i++)
        {
            if (this._weapons[i] != null && this._weapons[i].Decorator != null)
            {
                UnityEngine.Object.Destroy(this._weapons[i].Decorator.gameObject);
            }
            this._weapons[i] = null;
        }
        for (int j = 0; j < LoadoutManager.WeaponSlots.Length; j++)
        {
            global::LoadoutSlotType slot = LoadoutManager.WeaponSlots[j];
            InventoryItem           inventoryItem;
            if (Singleton <LoadoutManager> .Instance.TryGetItemInSlot(slot, out inventoryItem))
            {
                WeaponSlot weaponSlot = new WeaponSlot(slot, inventoryItem.Item, attachPoint, this);
                this.AddGameLogicToWeapon(weaponSlot);
                this._weapons[j] = weaponSlot;
                AmmoDepot.SetMaxAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).MaxAmmo);
                AmmoDepot.SetStartAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).StartAmmo);
                this.SetSlotWeapon(slot, inventoryItem.Item);
            }
            else
            {
                this.SetSlotWeapon(slot, null);
            }
        }
        GameState.Current.PlayerData.LoadoutWeapons.Value = this.LoadoutWeapons;
        Singleton <QuickItemController> .Instance.Initialize();

        this.Reset();
    }
Пример #4
0
    // Token: 0x06001F7B RID: 8059 RVA: 0x000970A4 File Offset: 0x000952A4
    public bool Shoot()
    {
        bool result = false;

        if (this.IsWeaponReady)
        {
            if (this.CheckAmmoCount())
            {
                this._currentSlot.InputHandler.FireHandler.RegisterShot();
                if (!GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.QuickSwitch, GameState.Current.RoomData.GameFlags))
                {
                    this._holsterTime = WeaponConfigurationHelper.GetRateOfFire(this._currentSlot.View);
                }
                Ray ray = new Ray(GameState.Current.PlayerData.ShootingPoint + GameState.Current.Player.EyePosition, GameState.Current.PlayerData.ShootingDirection);
                CmunePairList <BaseGameProp, ShotPoint> cmunePairList;
                this._currentSlot.Logic.Shoot(ray, out cmunePairList);
                if (!this._currentSlot.Decorator.HasShootAnimation)
                {
                    WeaponFeedbackManager.Instance.Fire();
                }
                AmmoDepot.UseAmmoOfClass(this._currentSlot.View.ItemClass, this._currentSlot.Logic.AmmoCountPerShot);
                GameState.Current.PlayerData.WeaponFired.Value = this._currentSlot;
                result = true;
            }
            else
            {
                this._currentSlot.Decorator.PlayOutOfAmmoSound();
                GameData.Instance.OnNotificationFull.Fire(string.Empty, "Out of ammo!", 1f);
            }
        }
        return(result);
    }
Пример #5
0
    // Token: 0x06001E09 RID: 7689 RVA: 0x000943EC File Offset: 0x000925EC
    public static void RemoveExtraAmmoOfType(UberstrikeItemClass t)
    {
        AmmoType key;

        if (AmmoDepot.TryGetAmmoType(t, out key) && AmmoDepot._currentAmmo[key] > AmmoDepot._maxAmmo[key])
        {
            AmmoDepot._currentAmmo[key] = AmmoDepot._maxAmmo[key];
        }
    }
Пример #6
0
    // Token: 0x06001DFA RID: 7674 RVA: 0x000940CC File Offset: 0x000922CC
    public static void AddAmmoOfClass(UberstrikeItemClass c)
    {
        AmmoType t;

        if (AmmoDepot.TryGetAmmoType(c, out t))
        {
            AmmoDepot.AddDefaultAmmoOfType(t);
        }
    }
Пример #7
0
    // Token: 0x06001E03 RID: 7683 RVA: 0x00094270 File Offset: 0x00092470
    public static int MaxAmmoOfClass(UberstrikeItemClass t)
    {
        AmmoType key;

        if (AmmoDepot.TryGetAmmoType(t, out key))
        {
            return(AmmoDepot._maxAmmo[key]);
        }
        return(0);
    }
Пример #8
0
    // Token: 0x06001E02 RID: 7682 RVA: 0x0009424C File Offset: 0x0009244C
    public static int AmmoOfClass(UberstrikeItemClass t)
    {
        AmmoType t2;

        if (AmmoDepot.TryGetAmmoType(t, out t2))
        {
            return(AmmoDepot.AmmoOfType(t2));
        }
        return(0);
    }
    // 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);
    }
Пример #10
0
 // Token: 0x06001658 RID: 5720 RVA: 0x0007C478 File Offset: 0x0007A678
 private void Start()
 {
     this.baseWidth = this.bgr.transform.localScale.x;
     this.baseScale = this.text.transform.localScale.x;
     GameState.Current.PlayerData.ActiveWeapon.AddEventAndFire(delegate(WeaponSlot el)
     {
         if (el != null)
         {
             WeaponSlot currentWeapon = Singleton <WeaponController> .Instance.GetCurrentWeapon();
             this.oldValue            = (float)AmmoDepot.AmmoOfClass(currentWeapon.View.ItemClass);
             this.OnChanged();
         }
     }, this);
     GameState.Current.PlayerData.Ammo.AddEvent(delegate(int el)
     {
         this.OnChanged();
     }, this);
 }
Пример #11
0
    // Token: 0x06001659 RID: 5721 RVA: 0x0007C504 File Offset: 0x0007A704
    private void OnChanged()
    {
        WeaponSlot currentWeapon = Singleton <WeaponController> .Instance.GetCurrentWeapon();

        bool flag = currentWeapon != null && currentWeapon.View.ItemClass != UberstrikeItemClass.WeaponMelee;

        this.panel.alpha = (float)((!flag) ? 0 : 1);
        if (!flag)
        {
            return;
        }
        int num      = AmmoDepot.AmmoOfClass(currentWeapon.View.ItemClass);
        int maxValue = AmmoDepot.MaxAmmoOfClass(currentWeapon.View.ItemClass);

        base.StopAllCoroutines();
        if ((float)num != this.oldValue)
        {
            base.StartCoroutine(this.PulseCrt((float)num >= this.oldValue));
        }
        base.StartCoroutine(this.AnimateCrt(num, maxValue));
    }
Пример #12
0
    // Token: 0x06001E07 RID: 7687 RVA: 0x000943A8 File Offset: 0x000925A8
    public static bool UseAmmoOfClass(UberstrikeItemClass t, int count = 1)
    {
        AmmoType t2;

        return(AmmoDepot.TryGetAmmoType(t, out t2) && AmmoDepot.UseAmmoOfType(t2, count));
    }
Пример #13
0
    // Token: 0x06001E00 RID: 7680 RVA: 0x0009421C File Offset: 0x0009241C
    public static bool HasAmmoOfClass(UberstrikeItemClass t)
    {
        AmmoType t2;

        return(t == UberstrikeItemClass.WeaponMelee || (AmmoDepot.TryGetAmmoType(t, out t2) && AmmoDepot.HasAmmoOfType(t2)));
    }
Пример #14
0
 // Token: 0x06001DFB RID: 7675 RVA: 0x00013EFF File Offset: 0x000120FF
 public static void AddDefaultAmmoOfType(AmmoType t)
 {
     AmmoDepot.AddAmmoOfType(t, AmmoDepot._startAmmo[t]);
 }
Пример #15
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]);
    }
Пример #16
0
 // Token: 0x06001F7A RID: 8058 RVA: 0x00014C08 File Offset: 0x00012E08
 public bool CheckAmmoCount()
 {
     return(AmmoDepot.HasAmmoOfClass(this._currentSlot.View.ItemClass));
 }