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); } }
public void SetWeaponAtSlot(Importing.Items.Definitions.WeaponDef weaponDef, WeaponSlot slot) { this.SetWeaponAtSlot(weaponDef.Id, slot); }
public void SetWeaponAtSlot(int weaponId, WeaponSlot slot) { this.SetWeaponAtSlot(weaponId, (int)slot); }
public void SwitchWeapon(WeaponSlot slot) { this.SwitchWeapon((int)slot); }