//武器制造、分配 public Weapon CreateWeapon(int id, int lv, Role owner) { Weapon wp = new Weapon(id, lv, owner); Weapons.Add(wp); return(wp); }
private void SetWeapons() { foreach (var weaponName in WeaponsAllowed) { Weapons.Add(weaponName, null); } }
private void CreateLocalLists() { foreach (Robot robot in BaseFile.Robots) { Robots.Add(robot); } foreach (Weapon weapon in BaseFile.Weapons) { Weapons.Add(weapon); } foreach (Polymodel model in BaseFile.Models) { Models.Add(model); } foreach (JointPos joint in BaseFile.Joints) { Joints.Add(joint); } foreach (ushort bm in BaseFile.ObjBitmaps) { ObjBitmaps.Add(bm); } foreach (ushort bm in BaseFile.ObjBitmapPointers) { ObjBitmapPointers.Add(bm); } }
public void AddWeapon(WeaponTypes weaponType) { if (!Weapons.Contains(weaponType)) { Weapons.Add(weaponType); } }
protected override void OnInitialize() { base.OnInitialize(); AttributesComponent = this.GetDependency <AttributesComponent>(); //_Weapons = new WeaponCollection(); if (string.IsNullOrEmpty(DefaultWeaponName)) { return; } if (Weapons.Count != 0) { return; } _CurrentWeaponIndex = 0; //Creates the weapon from a blueprint. var weapon = CorvEngine.Components.Blueprints.EntityBlueprint.GetBlueprint(DefaultWeaponName).CreateEntity(); var attri = weapon.GetComponent <AttributesComponent>(); var props = weapon.GetComponent <CombatPropertiesComponent>(); var data = weapon.GetComponent <WeaponPropertiesComponent>(); var effect = weapon.GetComponent <StatusEffectPropertiesComponent>(); _DefaultWeapon = new Weapon(data.WeaponData, props.CombatProperties, attri.Attributes, effect.StatusEffectAttributes); Weapons.Add(_DefaultWeapon); weapon.Dispose(); }
public void AddWeapon(Weapon.Model model) { if (!Weapons.ContainsKey(model)) { GameObject weaponGO = Instantiate(Resources.Load <GameObject>( Paths.Prefabs.WEAPONS + model.ToString())); weaponGO.transform.SetParent(weaponPoint); weaponGO.transform.localPosition = Vector3.zero; weaponGO.transform.localEulerAngles = Vector3.zero; Weapon weapon = weaponGO.GetComponent <Weapon>(); Weapons.Add(model, weapon); CurrentWeaponModel = model; SetCurrentWeaponGameObject(); } else { Weapons[model].Reload(); if (model == CurrentWeaponModel) { CurrentWeaponModel = model; } } }
/// <summary> /// update the game item category lists /// </summary> public void UpdateInventoryCategories() { Potions.Clear(); Weapons.Clear(); Treasure.Clear(); Relics.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Potion) { Potions.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Weapon) { Weapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Treasure) { Treasure.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Relic) { Relics.Add(gameItemQuantity); } } }
/// <summary> /// Add edited weapon. /// </summary> public async void Insert(string weaponType) { await _data.Set(_mapper.Map <WeaponProtModel>(_editedWeapon)); Weapons.Add(new WeaponProtDisplay(_editedWeapon)); SelectedWeapon = null; }
public void UpdateInventoryCategories() { Consumables.Clear(); Weapons.Clear(); KeyItems.Clear(); Statements.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Consumable) { Consumables.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Weapon) { Weapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is KeyItem) { KeyItems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Statement) { Statements.Add(gameItemQuantity); } } }
private void CreateWeapons(int addition = 0) { int x, y; while (Weapons.Count <= addition) { x = r.Next(7) * 40; y = r.Next(7) * 40; bool quit = false; foreach (Weapon w in Weapons) { if (w.X == x && w.Y == y) { quit = true; } } if (quit) { continue; } Weapons.Add(new Weapon(x, y)); } }
public void UpdateInventoryCategories() { MediPack.Clear(); Weapons.Clear(); Currency.Clear(); Clue.Clear(); foreach (var gameItem in _inventory) { if (gameItem is Potion) { MediPack.Add(gameItem); } if (gameItem is Weapon) { Weapons.Add(gameItem); } if (gameItem is Coin) { Currency.Add(gameItem); } if (gameItem is Clues) { Clue.Add(gameItem); } } }
internal void CompChange(bool add, WeaponComponent comp) { if (add) { if (WeaponsIdx.ContainsKey(comp)) { return; } WeaponsIdx.Add(comp, Weapons.Count); Weapons.Add(comp); } else { int idx; if (!WeaponsIdx.TryGetValue(comp, out idx)) { return; } Weapons.RemoveAtFast(idx); if (idx < Weapons.Count) { WeaponsIdx[Weapons[idx]] = idx; } WeaponsIdx.Remove(comp); } }
/// <summary> /// Initializes a new instance of the <see cref="EquipmentViewModel"/> class. /// </summary> /// <param name="warriorViewModel">The warrior view model.</param> /// <exception cref="ArgumentNullException">WarriorViewModel is null</exception> public EquipmentViewModel(WarriorViewModel warriorViewModel) { if (warriorViewModel == null) { throw new ArgumentNullException("WarriorViewModel is null"); } WarriorViewModel = warriorViewModel; Warrior = warriorViewModel.Warrior; SetEquipment(); RemoveEquipmentCommand = new RemoveEquipment(this); SelectEquipmentCommand = new SelectEquipment(this); foreach (IEquipment equipment in Warrior.AllowedEquipment) { if (equipment is ICloseCombatWeapon) { Weapons.Add(new CloseCombatWeaponViewModel(equipment as ICloseCombatWeapon)); } if (equipment is IMisseleWeapon) { MissileWeapons.Add(new MissileWeaponViewModel(equipment as IMisseleWeapon)); } if (equipment is IArmour) { Armour.Add(new ArmorViewModel(equipment as IArmour)); } } Warrior.PropertiesChanged += Warrior_PropertiesChanged; }
public bool AddWeapon(WeaponItem Item, UnityAction AfterAddItem) //获得装备 { if (Weapons.Count == MAX_WEAPON_COUNT) //装备已满返回false { Debug.Log("物品已达上限"); weapons.Add(Item); RPG.UI.SendItemToWarehouse Sender = UIController.Instance.GetUI <RPG.UI.SendItemToWarehouse>(); Sender.Show(weapons); return(false); } else { if (_currentEquipItemIndex < 0) //没有装备武器,判断武器是否可以装备,如果可以装备到第一格,否则直接添加到末尾 { if (IsWeaponEnabled(Item.ID)) //可用的武器 { Weapons.Insert(0, Item); EquipWeapon(0); } else { Weapons.Add(Item); } } else { Weapons.Add(Item); } return(true); } }
private void AddWeapon(string weapon) { if (!Weapons.Contains(weapon)) { Weapons.Add(weapon); } }
public GroupWeapon(XmlNode n) : base(n) { // Проверяем, что таких ID, Name и ImageIndex нет foreach (GroupWeapon gw in FormMain.Config.GroupWeapons) { if (gw.ID == ID) { throw new Exception("Группа оружия с ID = " + gw.ID + " уже существует."); } if (gw.Name == Name) { throw new Exception("Группа оружия с Name = " + gw.Name + " уже существует."); } if (gw.ImageIndex == ImageIndex) { throw new Exception("Группа оружия с ImageIndex = " + gw.ImageIndex.ToString() + " уже существует."); } } XmlNode nl = n.SelectSingleNode("Weapons"); if (nl != null) { Weapon w; foreach (XmlNode l in nl.SelectNodes("Weapon")) { w = new Weapon(this, l); Weapons.Add(w); } } }
public void UpdateInventoryCategories() { Potions.Clear(); Treasures.Clear(); Weapons.Clear(); Allies.Clear(); foreach (var GameItem in _inventory) { if (GameItem.GameItem is Potion) { Potions.Add(GameItem); } if (GameItem.GameItem is Treasure) { Treasures.Add(GameItem); } if (GameItem.GameItem is Weapon) { Weapons.Add(GameItem); } if (GameItem.GameItem is Allies) { Allies.Add(GameItem); } } }
public void RegisterWeapon(Weapon weapon) { if (weapon != null && !Weapons.Contains(weapon)) { Weapons.Add(weapon); } }
public override void Execute(string[] args) { string[] weaponType = args[0].Split(); IRarity rarity = rarityFactory.Create(weaponType[0]); IWeapon weapon = weaponFactory.Create(weaponType[1], args[1], rarity); Weapons.Add(weapon.Name, weapon); }
internal WeaponsNode(string json) : base(json) { foreach (JToken weapon in _data.Children()) { Weapons.Add(new WeaponNode(weapon.First.ToString())); } }
internal void CompChange(bool add, WeaponComponent comp) { if (add) { if (WeaponsIdx.ContainsKey(comp)) { Log.Line($"CompAddFailed:<{comp.MyCube.EntityId}> - comp({comp.MyCube.DebugName}[{comp.MyCube.BlockDefinition.Id.SubtypeName}]) already existed in {MyGrid.DebugName}"); return; } if (comp.HasArmor) { for (int i = 0; i < comp.Platform.Weapons.Length; i++) { var w = comp.Platform.Weapons[i]; if (w.System.Armor != WeaponDefinition.HardPointDef.HardwareDef.ArmorState.IsWeapon) { Armor.Add(w.Comp.MyCube, w); } } Session.ArmorCubes.Add(comp.MyCube, comp); } WeaponsIdx.Add(comp, Weapons.Count); //Session.IdToCompMap.Add(comp.MyCube.EntityId, comp); Weapons.Add(comp); } else { int idx; if (!WeaponsIdx.TryGetValue(comp, out idx)) { Log.Line($"CompRemoveFailed: <{comp.MyCube.EntityId}> - {Weapons.Count}[{WeaponsIdx.Count}]({WeaponBase.Count}) - {Weapons.Contains(comp)}[{Weapons.Count}] - {Session.GridTargetingAIs[comp.MyCube.CubeGrid].WeaponBase.ContainsKey(comp.MyCube)} - {Session.GridTargetingAIs[comp.MyCube.CubeGrid].WeaponBase.Count} "); return; } if (comp.HasArmor) { for (int i = 0; i < comp.Platform.Weapons.Length; i++) { var w = comp.Platform.Weapons[i]; if (w.System.Armor != WeaponDefinition.HardPointDef.HardwareDef.ArmorState.IsWeapon) { Armor.Remove(w.Comp.MyCube); } } Session.ArmorCubes.Remove(comp.MyCube); } Weapons.RemoveAtFast(idx); if (idx < Weapons.Count) { WeaponsIdx[Weapons[idx]] = idx; } //Session.IdToCompMap.Remove(comp.MyCube.EntityId); WeaponsIdx.Remove(comp); } }
public Inventory Add(Weapon w) { if (Weapons.Count >= MaxSize) { throw new ArgumentOutOfRangeException(); } Weapons.Add(w); return(this); }
// Add a weapon to the players inventory public void AddWeapon(Weapon weapon) { Weapon temp = Weapons.Where(x => x.Name == weapon.Name).FirstOrDefault(); if (temp == null) { Weapons.Add(weapon); } }
public int AddWeapon(List <Weapon> weaponsList, int id) { if (!ValidListInput(weaponsList, id)) { return(-1); } Weapons.Add(new Weapon(weaponsList[id])); return(Weapons.Last().Id); }
private void ExecuteAddWeapon() { AddWeaponWindowViewModel addWeaponWindowViewModel = new AddWeaponWindowViewModel(); Model.Weapon weapon = addWeaponWindowViewModel.GetWeapon(); if (weapon != null) { Weapons.Add(weapon); } }
public PlayerState(PlayerData playerData) { HealthState = new HealthState(playerData.HealthData); InventoryState = new InventoryState(playerData.DefaultInventory); var weapon = new WeaponState(playerData.DefaultWeapon, InventoryState); weapon.Reload(true); Weapons.Add(playerData.DefaultWeapon.Name, weapon); CurrentWeapon = weapon; }
public override void Execute() { string[] weaponInfo = Data[0].Split().ToArray(); string rarityType = weaponInfo[0]; string type = weaponInfo[1]; string name = Data[1]; Weapon weapon = WeaponFactory.GetWeapon(rarityType, type, name); Weapons.Add(name, weapon); }
public Weapon(string name, int mag, float shoot, float focus, float maxS, float minS) { this.name = name; magazineSize = mag; shootDelay = shoot; focusTime = focus; maxSpread = maxS; minSpread = minS; Weapons.Add(this); }
public Kernel(Stream stream) { using (var reader = new BinaryReader(stream)) { var sectionCount = reader.ReadUInt32(); var sectionOffsets = new List <uint>(); for (int i = 0; i < sectionCount; i++) { sectionOffsets.Add(reader.ReadUInt32()); } // sections 0-1 stream.Seek(0, SeekOrigin.Begin); PreGFData = reader.ReadBytes((int)(sectionOffsets[2])); // section 2 = junctionable gf for (int i = 0; i < 16; i++) { JunctionableGFs.Add(new JunctionableGF(reader.ReadBytes(132))); } // section 3 PostGFData = reader.ReadBytes((int)(sectionOffsets[4] - stream.Position)); // section 4 = weapons for (int i = 0; i < 33; i++) { Weapons.Add(new Weapon(reader.ReadBytes(12))); } //sections 5-10 PostWeaponData = reader.ReadBytes((int)(sectionOffsets[11] - stream.Position)); // sections 11-17 = abilities while (sectionOffsets[18] - stream.Position >= 8) { Abilities.Add(new Ability(reader.ReadBytes(8))); } // sections 18-34 PostAbilityData = reader.ReadBytes((int)(sectionOffsets[35] - stream.Position)); // section 35 = weapon text WeaponText = reader.ReadBytes((int)(sectionOffsets[36] - stream.Position)); foreach (var w in Weapons) { w.Name = FF8String.Decode(WeaponText.Skip(w.NameOffset)); } // sections 36-55 PostWeaponTextData = reader.ReadBytes((int)(stream.Length - stream.Position)); } }
public void AddWeapon(Weapon weapon) { if (!Weapons.ContainsKey(weapon.Name)) { Weapons.Add(weapon.Name, weapon); } if (m_weapon == null) { EquipWeapon(weapon.Name); } }