Exemplo n.º 1
0
        // Возвращает массив из строк - характеристики всего оружия определенного типа
        public string[] GetCharacteristicsOfWeapons(Weapons.WeaponsType type)
        {
            switch (type)
            {
            case Weapons.WeaponsType.Bow:
                return(this.Bow.GetCharacteristics());

            case Weapons.WeaponsType.Sword:
                List <string> result = new List <string>();
                foreach (var t in this.Swords)
                {
                    result.AddRange(t.GetCharacteristics().ToList());
                }
                return(result.ToArray());

            case Weapons.WeaponsType.Spell:
                List <string> res = new List <string>();
                foreach (var t in this.Spells)
                {
                    res.AddRange(t.GetCharacteristics().ToList());
                }
                return(res.ToArray());
            }
            return(null);
        }
Exemplo n.º 2
0
    public int GetDamage(Weapons.WeaponsType type)
    {
        foreach (var weapon in Weaponses)
        {
            if (weapon.weaponsType == type)
            {
                return(weapon.damage);
            }
        }

        return(0);
    }
Exemplo n.º 3
0
    public float getWeapontDistanceAttack(Weapons.WeaponsType type)
    {
        foreach (var weapon in Weaponses)
        {
            if (weapon.weaponsType == type)
            {
                return(weapon.distanceToAttack);
            }
        }

        return(0);
    }
Exemplo n.º 4
0
    public bool isWeapontDistanceAttack(Weapons.WeaponsType type)
    {
        foreach (var weapon in Weaponses)
        {
            if (weapon.weaponsType == type)
            {
                return(weapon.isDistanceAttack);
            }
        }

        return(false);
    }
Exemplo n.º 5
0
    public GameObject GetMeshWeapont(Weapons.WeaponsType type)
    {
        foreach (var weapon in Weaponses)
        {
            if (weapon.weaponsType == type)
            {
                return(weapon.meshObject);
            }
        }

        return(null);
    }
Exemplo n.º 6
0
 public void PlayWeaponFX(Weapons.WeaponsType weaponsType)
 {
     foreach (var weapon in Weaponses)
     {
         if (weapon.weaponsType == weaponsType)
         {
             if (weapon.hasWeaponFx)
             {
                 weapon.meshObject.GetComponentInChildren <WeaponFX>().Play();
             }
             break;
         }
     }
 }
Exemplo n.º 7
0
 // Выводит изношенность определенного вида оружия
 private void PrintWeaponsHealth(Weapons.WeaponsType type)
 {
     if (type == Weapons.WeaponsType.Spell)
     {
         Console.WriteLine("Заклинания не изнашиваются со временем");
     }
     if (type == Weapons.WeaponsType.Bow)
     {
         PrintHPofOneThing(this.Bow.Name, this.Bow.MaxHealth, this.Bow.CurrentHelth);
     }
     if (type == Weapons.WeaponsType.Sword)
     {
         foreach (var sword in this.Swords)
         {
             PrintHPofOneThing(sword.Name, sword.MaxHealth, sword.CurrentHelth);
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Нанесение атаки врагу, в зависимости от выбранного оружия увеличиваем навык владения
        /// </summary>
        /// <param name="countEnemy"> Количество противников </param>
        /// <param name="weapons"> Тип оружия </param>
        /// <param name="bow"> Лук, при наличии </param>
        /// <param name="spell"> Заклинание, при наличии </param>
        /// <param name="sword"> Меч, при наличии </param>
        /// <param name="nums">индексы противников, которых надо атаковать</param>
        /// <returns>Массив с уроном для противников</returns>
        public int[] Attack(int countEnemy, Weapons.WeaponsType weapons,
                            Bow bow = null, Spell spell = null, Sword sword = null, params int[] nums)
        {
            switch (weapons)
            {
            case Weapons.WeaponsType.Bow:
                this.BowSkill += 0.0001f;
                return(SimpleBowAttack(countEnemy, bow));

            case Weapons.WeaponsType.Spell:
                this.MagicSkill += 0.0001f;
                return(SimpleSpellAttack(countEnemy, spell, nums));

            case Weapons.WeaponsType.Sword:
                this.SwordSkill += 0.0001f;
                return(SimpleSwordAttack(countEnemy, sword, nums));
            }
            return(new int[0]);
        }