Esempio n. 1
0
    //Modifies the players stats according to the items data
    void InitItemData(ItemStats item, PlayerCharacter playerCharacter, PlayerVisualsManager playerVisuals)
    {
        playerCharacter.maxHealth     += item.healthMod;
        playerCharacter.totalSpeedMod += item.speedMod;
        playerCharacter.staggerWindow += item.staggerMod;
        playerCharacter.initialArmor  += item.armorMod;
        playerCharacter.attackDamage  += item.damageMod;

        playerVisuals.DisplayEquipment(item);
    }
    public void EquipItem(ItemStats item)
    {
        if (item == null)
        {
            return;
        }
        EquipSlotVisuals relatedVisuals = visualsByType[(int)item.itemSlot];

        switch (item.itemSlot)
        {
        case SlotType.Head: playerData.helmetSlotAdress = item.itemAdress;
            break;

        case SlotType.Chest: playerData.chestArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Hands: playerData.gauntletSlotAdress = item.itemAdress;
            break;

        case SlotType.Legs: playerData.legArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Feet: playerData.footArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Weapon: playerData.weaponSlotAdress = item.itemAdress;
            break;
        }

        relatedVisuals.itemIcon.sprite = item.menuSprite;
        //Displays the items stats on the main equip screen
        SetSlotIcons(relatedVisuals.healthIndicator, item.healthMod, positiveHealthSprite, negativeHealthSprite);
        SetSlotIcons(relatedVisuals.armorIndicator, item.armorMod, armorSprite, null);
        SetSlotIcons(relatedVisuals.speedIndicator, Mathf.FloorToInt(item.speedMod * 10), positiveSpeedSprite, negativeSpeedSprite);
        SetSlotIcons(relatedVisuals.parryTimeIndicator, Mathf.FloorToInt(item.staggerMod * 10), positiveParryTimeSprite, negativeParryTimeSprite);
        SetSlotIcons(relatedVisuals.damageIndicator, item.damageMod, positiveDamageSprite, negativeDamageSprite);
        playerVisuals.DisplayEquipment(item);
        //Save Selection to the Savefile and return to the main equip screen.
        playerData.SaveDataToPrefs();
    }