Exemplo n.º 1
0
        private void OnTimedEvent(SpawnLocation l)
        {
            string itemType = "";

            switch (l.itemType)
            {
            case "DamageBoost":
                Item damageBoost = new Item(l);
                l.addItem(damageBoost);
                cmdManager.InitializeItem(damageBoost);
                break;

            case "SpeedBoost":
                Item speedBoost = new Item(l);
                l.addItem(speedBoost);
                cmdManager.InitializeItem(speedBoost);
                break;

            case "AHA":
                Random   random      = new Random();
                string[] itemOptions = new string[] { "HealthItem", "HealthItem", "ArmourItem", "AmmoItem", "AmmoItem" };
                itemType = itemOptions[random.Next(5)];
                break;
            }

            if (itemType == "HealthItem")
            {
                l.changeItem(itemType);
                HealthItem newHItem = new HealthItem(l);
                l.addItem(newHItem);
                cmdManager.InitializeItem(newHItem);
                l.changeItem("AHA");
            }
            if (itemType == "ArmourItem")
            {
                l.changeItem(itemType);
                ArmourItem newAItem = new ArmourItem(l);
                l.addItem(newAItem);
                cmdManager.InitializeItem(newAItem);
                l.changeItem("AHA");
            }
            if (itemType == "AmmoItem")
            {
                l.changeItem(itemType);
                AmmoItem newAmmoItem = new AmmoItem(l);
                l.addItem(newAmmoItem);
                cmdManager.InitializeItem(newAmmoItem);
                l.changeItem("AHA");
            }
        }
Exemplo n.º 2
0
    private void ShowArmours()
    {
        ShowEquippables();

        GUILayout.Label("> Armour", EditorStyles.boldLabel);
        //newArmourType = (Enums.eArmourLocation)EditorGUILayout.EnumPopup("Armour Type: ", newArmourType);
        ArmourItem armour = (ArmourItem)mCurrentCreateType;

        switch (armour.Location)
        {
        case Enums.eArmourLocation.Head:
            GUILayout.Label("  > Head", EditorStyles.boldLabel);
            //if (mCurrentItem.GetType() != typeof(HeadArmourItem))
            //{
            //    mCurrentItem = new HeadArmourItem();
            //}
            break;

        case Enums.eArmourLocation.Body:
            GUILayout.Label("  > Body", EditorStyles.boldLabel);
            BodySlots = EditorGUILayout.IntField("# Slots: ", Mathf.Clamp(BodySlots, 0, 5));
            //if (mCurrentItem.GetType() != typeof(BodyArmourItem))
            //{
            //    mCurrentItem = new BodyArmourItem();
            //}
            break;

        case Enums.eArmourLocation.Arm:
            GUILayout.Label("  > Arm", EditorStyles.boldLabel);
            //if (mCurrentItem.GetType() != typeof(ArmArmourItem))
            //{
            //    mCurrentItem = new ArmArmourItem();
            //}
            break;
        }
    }
Exemplo n.º 3
0
        public void EquipArmour(ArmourItem armourItem)
        {
            #region Base Stats

            _playerAbilitySystem.strength     += armourItem.strengthAmount;
            _playerAbilitySystem.intelligence += armourItem.intelligenceAmount;
            _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount      += armourItem.physicalArmour;
            _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount += armourItem.elementalArmour;

            switch (armourItem.healthAmount)
            {
            case > 0:
                _player.maxHp += armourItem.healthAmount;
                break;

            case < 0:
                _player.maxHp -= armourItem.healthAmount;
                break;
            }

            switch (armourItem.manaAmount)
            {
            case > 0:
                _playerAbilitySystem.maxMana += armourItem.manaAmount;
                break;

            case < 0:
                _playerAbilitySystem.maxMana -= armourItem.manaAmount;
                break;
            }

            switch (armourItem.strengthAmount)
            {
            // Update Player Stats
            case < 0:
                _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                break;

            case > 0:
                _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                break;
            }

            switch (armourItem.intelligenceAmount)
            {
            case < 0:
                _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                break;

            case > 0:
                _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                break;
            }

            #endregion

            // ## HELMET ITEM ##
            if (armourItem is HelmetItem helmetItem)
            {
                head = helmetItem;
                _playerAbilitySystem.manaRegenerationPercentage += helmetItem.manaRegenerationPercentage;
                _player.GetComponent <SkillsManager>().activeSkills.ForEach(skill => skill.manaCost -= helmetItem.reducedManaCostOfSkillsAmount);
                _playerAbilitySystem.reducedManaCostOfSkillsAmount += helmetItem.reducedManaCostOfSkillsAmount;
            }

            // ## CHEST ITEM ##
            if (armourItem is ChestItem chestItem)
            {
                chest = chestItem;
                _playerAbilitySystem.healthOnHitAmount += chestItem.healthOnHitAmount;
                if (_playerAbilitySystem.GetComponent <PlayerEquipmentManager>().hasWeaponEquipped)
                {
                    _playerAbilitySystem.GetComponent <PlayerEquipmentManager>().weaponItem.weaponRange += chestItem.additionalWeaponRangeAmount;
                }
            }

            if (armourItem is BootItem bootItem)
            {
                boots = bootItem;
                _playerAbilitySystem.moveSpeedIncreaseAmount += bootItem.moveSpeedIncrease;
                // Increase Movement Speed
                GetComponent <NavMeshAgent>().speed += (bootItem.moveSpeedIncrease / 100 * GetComponent <NavMeshAgent>().speed);
            }

            // ## Add Armour to Equipment Inventory ##
            _equipmentInventory.AddItem(armourItem);
        }