コード例 #1
0
ファイル: WeaponManager.cs プロジェクト: Aimoux/QFramework
    //武器制造、分配
    public Weapon CreateWeapon(int id, int lv, Role owner)
    {
        Weapon wp = new Weapon(id, lv, owner);

        Weapons.Add(wp);
        return(wp);
    }
コード例 #2
0
 private void SetWeapons()
 {
     foreach (var weaponName in WeaponsAllowed)
     {
         Weapons.Add(weaponName, null);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 public void AddWeapon(WeaponTypes weaponType)
 {
     if (!Weapons.Contains(weaponType))
     {
         Weapons.Add(weaponType);
     }
 }
コード例 #5
0
ファイル: EquipmentComponent.cs プロジェクト: Octanum/Corvus
        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();
        }
コード例 #6
0
    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;
            }
        }
    }
コード例 #7
0
        /// <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);
                }
            }
        }
コード例 #8
0
        /// <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;
        }
コード例 #9
0
ファイル: Player.cs プロジェクト: mileskav/TBGame
        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);
                }
            }
        }
コード例 #10
0
        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));
            }
        }
コード例 #11
0
ファイル: Player.cs プロジェクト: richar35/TBQuestFinalGame
        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);
                }
            }
        }
コード例 #12
0
ファイル: AiSupport.cs プロジェクト: Coreman230/WeaponCore
        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);
            }
        }
コード例 #13
0
        /// <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;
        }
コード例 #14
0
ファイル: ItemGroup.cs プロジェクト: PenpenLi/Hifior
 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);
     }
 }
コード例 #15
0
ファイル: Critter.cs プロジェクト: chrisdw/Traveller.Cepheus
 private void AddWeapon(string weapon)
 {
     if (!Weapons.Contains(weapon))
     {
         Weapons.Add(weapon);
     }
 }
コード例 #16
0
        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);
                }
            }
        }
コード例 #17
0
ファイル: Player.cs プロジェクト: Kaulitza/WpfTBQuestGame.S3
 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);
         }
     }
 }
コード例 #18
0
 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);
    }
コード例 #20
0
 internal WeaponsNode(string json)
     : base(json)
 {
     foreach (JToken weapon in _data.Children())
     {
         Weapons.Add(new WeaponNode(weapon.First.ToString()));
     }
 }
コード例 #21
0
ファイル: AiSupport.cs プロジェクト: keleios/WeaponCore
        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);
            }
        }
コード例 #22
0
ファイル: Inventory.cs プロジェクト: Oleg979/CSharp-lessons
 public Inventory Add(Weapon w)
 {
     if (Weapons.Count >= MaxSize)
     {
         throw new ArgumentOutOfRangeException();
     }
     Weapons.Add(w);
     return(this);
 }
コード例 #23
0
        // 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);
            }
        }
コード例 #24
0
ファイル: Battler.cs プロジェクト: rafapena/SideBattleRPG
 public int AddWeapon(List <Weapon> weaponsList, int id)
 {
     if (!ValidListInput(weaponsList, id))
     {
         return(-1);
     }
     Weapons.Add(new Weapon(weaponsList[id]));
     return(Weapons.Last().Id);
 }
コード例 #25
0
        private void ExecuteAddWeapon()
        {
            AddWeaponWindowViewModel addWeaponWindowViewModel = new AddWeaponWindowViewModel();

            Model.Weapon weapon = addWeaponWindowViewModel.GetWeapon();
            if (weapon != null)
            {
                Weapons.Add(weapon);
            }
        }
コード例 #26
0
ファイル: PlayerState.cs プロジェクト: Pe1m4n/TheNightIsDark
        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;
        }
コード例 #27
0
    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);
    }
コード例 #28
0
        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);
        }
コード例 #29
0
ファイル: Kernel.cs プロジェクト: jewinters/maelstrom
        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));
            }
        }
コード例 #30
0
ファイル: Player.cs プロジェクト: nicolas-repiquet/Granite
        public void AddWeapon(Weapon weapon)
        {
            if (!Weapons.ContainsKey(weapon.Name))
            {
                Weapons.Add(weapon.Name, weapon);
            }

            if (m_weapon == null)
            {
                EquipWeapon(weapon.Name);
            }
        }