Esempio n. 1
0
    /**********************************************************************************************/
    // устанавливаем конкретное оружие в конкретный слот
    //
    /**********************************************************************************************/
    public void SetWeaponInSlot(PlayerController.WEAPON_SLOT slot, WEAPON weaponType)
    {
        if ((int)slot >= m_weaponImgCtrArr.Count)
        {
            Debug.LogError("ERROR! wrong weaponId: " + slot);
            return;
        }

        WeaponImageSet iconsSet = WeaponLibrary.GetInstance().GetWeaponIcons(weaponType);

        Debug.Log("SetWeaponInSlot");
        if (iconsSet.sprite100 == null)
        {
            Debug.LogError("iconsSet is empty!");
        }

        m_weaponImgCtrArr[(int)slot].SpriteSet = iconsSet;

        // настраиваем цветовую схему
        Color colorForUse = Color.white;

        if (iconsSet.UseColoring)
        {
            colorForUse = ColorChecme;
        }

        m_weaponImgCtrArr[(int)slot].SetColorScheme(colorForUse);
    }
Esempio n. 2
0
        public double Attack(StrikingDummy target, WeaponSkills weaponSkill)
        {
            var animationLocked = QueuedEffects.ContainsKey(Skills.StatusEffects.AnimationLocked);

            if (GcdDuration > 0 || animationLocked)
            {
                return(0);
            }

            var potency = WeaponLibrary.WeaponPotencies(weaponSkill, LastSkills);
            var damage  = FormulaLibrary.WeaponSkills(potency, Weapon.WeaponDamage, GetDexterity(), Det, CalculateMultiplier(target, DamageType.Slashing));

            if (StatusEffects.ContainsKey(Skills.StatusEffects.Duality))
            {
                damage *= 2;
                StatusEffects.Remove(Skills.StatusEffects.Duality);
            }
            else
            {
                damage = (damage * CalculateCritChance() * FormulaLibrary.CritDmg(Crt)) +
                         (damage * (1 - CalculateCritChance()));
            }

            WeaponLibrary.QueueEffect(this, target, weaponSkill);
            var gcdMultiplier = StatusEffects.ContainsKey(Skills.StatusEffects.Huton) ? 0.85 : 1.00;

            GcdDuration = (int)TimeSpan.FromSeconds(FormulaLibrary.Gcd(Sks, gcdMultiplier)).TotalMilliseconds;
            LastSkills.Push(weaponSkill);

            return(damage);
        }
Esempio n. 3
0
    private void Init()
    {
        I = this;
        DontDestroyOnLoad(gameObject);

        weaponLib = GetComponent<WeaponLibrary>();
        Strings.Init();
    }
Esempio n. 4
0
        public void OpenWeaponLibrary(string fileName)
        {
            XmlSerializer xmlSerializer    = new XmlSerializer(typeof(WeaponLibrary));
            FileStream    fs               = new FileStream(fileName, FileMode.Open);
            WeaponLibrary newWeaponLibrary = (WeaponLibrary)xmlSerializer.Deserialize(fs);

            newWeaponLibrary.FileName = fileName;
            WeaponLibraries.Add(newWeaponLibrary);
        }
Esempio n. 5
0
        public void Init(VehiclePanel panel, OutfitSlotItem slot, OutfitData outfit)
        {
            _Panel = panel;
            Slot   = slot;
            Outfit = outfit;

            var weaponData = outfit as WeaponOutfitData;

            if (weaponData != null)
            {
                nameTxt.text   = WeaponLibrary.GetWeaponData(weaponData.weaponType).name;
                iconImg.sprite = WeaponLibrary.GetWeaponData(weaponData.weaponType).iconSprite;
            }
        }
Esempio n. 6
0
    /**********************************************************************************/
    //  защищаемся от повторного создания объекта
    //
    /**********************************************************************************/
    void Awake()
    {
        // защищаемся от повторного создания объекта
        if (s_instance == null)
        {
            s_instance = this;
        }
        else if (s_instance != this)
        {
            Destroy(gameObject);
        }

        // делаем GameManager неучтожимым при загрузке новой сцены
        DontDestroyOnLoad(gameObject);
    }
Esempio n. 7
0
        public void DecrementQueuedEffectDuration(bool verbose)
        {
            foreach (var queuedEffect in QueuedEffects.ToList())
            {
                var effect = QueuedEffects[queuedEffect.Key];
                effect.Duration = effect.Duration - 1;
                QueuedEffects[queuedEffect.Key] = effect;

                if (effect.Duration <= 0)
                {
                    try
                    {
                        // ReSharper disable once AssignNullToNotNullAttribute
                        var effectName = Enum.GetName(typeof(StatusEffects), queuedEffect.Key);

                        WeaponSkills weaponSkill;
                        Spells       spell;
                        if (Enum.TryParse(effectName, true, out weaponSkill))
                        {
                            WeaponLibrary.ApplyEffect(effect.Target, weaponSkill, verbose, queuedEffect.Value);
                        }

                        if (Enum.TryParse(effectName, true, out spell))
                        {
                            SpellLibrary.ApplyEffect(effect.Target, spell);
                        }
                    }
                    catch
                    {
                        // ignored if it's another non-actionable type such as AnimationLocked
                    }
                    finally
                    {
                        QueuedEffects.Remove(queuedEffect.Key);
                    }
                }
            }
        }
Esempio n. 8
0
    /**********************************************************************************/
    // устанавливаем оружие в соответсвующие им слоты
    //
    /**********************************************************************************/
    private void SetWeaponToSlots()
    {
        // настраиваем оружие
        // тентакли ^_^
        ClassicWeaponCtr ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.TENTAKLES, playerId);

        m_mainWeaponCollection.Add(ctr);
        m_captureWeaponCollection.Add(ctr);
        m_explosionWeaponCollection.Add(ctr);
        m_specialWeaponCollection.Add(ctr);

        m_mainWeaponIds.Add(WEAPON.TENTAKLES);
        m_captureWeaponIds.Add(WEAPON.TENTAKLES);
        m_explosionWeaponIds.Add(WEAPON.TENTAKLES);
        m_specialWeaponIds.Add(WEAPON.TENTAKLES);


        // кислотная пушка
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.ACID_GUN, playerId);
        ctr.ChargeAmmo(ctr.NumberOfBullet);
        m_mainWeaponCollection.Add(ctr);
        m_mainWeaponIds.Add(WEAPON.ACID_GUN);

        // дробовик
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.SHOTGUN, playerId);
        ctr.ChargeAmmo(0);
        m_mainWeaponCollection.Add(ctr);
        m_mainWeaponIds.Add(WEAPON.SHOTGUN);

        // бластер
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.BLUSTER, playerId);
        ctr.ChargeAmmo(0);
        m_mainWeaponCollection.Add(ctr);
        m_mainWeaponIds.Add(WEAPON.BLUSTER);

        // слизь
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.MOCUS, playerId);
        ctr.ChargeAmmo(3);
        m_captureWeaponCollection.Add(ctr);
        m_captureWeaponIds.Add(WEAPON.MOCUS);

        // гранаты РГД
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.RGD_GRENADE, playerId);
        ctr.ChargeAmmo(0);
        m_explosionWeaponCollection.Add(ctr);
        m_explosionWeaponIds.Add(WEAPON.RGD_GRENADE);

        // гранаты плазменные
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.PLASMA_GRENADE, playerId);
        ctr.ChargeAmmo(0);
        m_explosionWeaponCollection.Add(ctr);
        m_explosionWeaponIds.Add(WEAPON.PLASMA_GRENADE);

        // строитель турелей
        ctr = WeaponLibrary.GetInstance().GetWeaponById(WEAPON.TUREL_BUILDER, playerId);
        ctr.ChargeAmmo(0);
        m_specialWeaponCollection.Add(ctr);
        m_specialWeaponIds.Add(WEAPON.TUREL_BUILDER);

        // обновляем оружейные слоты
        UpdateWeaponSlot(WEAPON_SLOT.ALL);
    }
 private void LoadLibrary()
 {
     _library = WeaponLibrary.sLibObject;
     _weapons = WeaponLibrary.Weapons;
 }