Beispiel #1
0
        public void AddRandomWeapons()
        {
            WeaponSlot[] slots = new WeaponSlot[] { WeaponSlot.Pistol, WeaponSlot.Shotgun, WeaponSlot.Submachine,
                                                    WeaponSlot.Machine, WeaponSlot.Rifle, WeaponSlot.Heavy };

            var groups = WeaponData.LoadedWeaponsData.Where(wd => slots.Contains((WeaponSlot)wd.weaponslot))
                         .GroupBy(wd => wd.weaponslot);

            foreach (var grp in groups)
            {
                int count = grp.Count();
                if (count < 1)
                {
                    continue;
                }

                int        index            = Random.Range(0, count - 1);
                WeaponData chosenWeaponData = grp.ElementAt(index);

                this.SetWeaponAtSlot(chosenWeaponData.modelId1, grp.Key);
            }
        }
Beispiel #2
0
 public void SetWeaponAtSlot(Importing.Items.Definitions.WeaponDef weaponDef, WeaponSlot slot)
 {
     this.SetWeaponAtSlot(weaponDef.Id, slot);
 }
Beispiel #3
0
 public void SetWeaponAtSlot(int weaponId, WeaponSlot slot)
 {
     this.SetWeaponAtSlot(weaponId, (int)slot);
 }
Beispiel #4
0
 public void SwitchWeapon(WeaponSlot slot)
 {
     this.SwitchWeapon((int)slot);
 }