Exemple #1
0
 public void EquipItem(int index)
 {
     ArmorData removedItem = partyData.CharacterEquipement[indexCharacterSelection].RemoveArmor(equipementListDrawer.IndexSelection);
     if(removedItem != null)
         partyData.Inventory.Add(removedItem.name);
     partyData.CharacterEquipement[indexCharacterSelection].EquipArmor(equipementListDrawer.IndexSelection, (ArmorData)itemsInventory[index]);
     partyData.Inventory.Remove(itemsInventory[index].name);
     SwitchToEquipement();
 }
 public void EquipArmor(int index, ArmorData newArmor)
 {
     while (armors.Count <= index)
         armors.Add(null);
     armors[index] = newArmor;
     for (int i = 0; i < armors[index].StatModifiers.Count; i++)
     {
         characterStatController.StatController.AddStat(new Stat(armors[index].StatModifiers[i].StatName, armors[index].StatModifiers[i].StatValue), armors[index].StatModifiers[i].ModifierType);
     }
 }
        public ArmorData RemoveArmor(int index)
        {
            if (index >= armors.Count)
                return null;
            if (armors[index] == null)
                return null;

            for (int i = 0; i < armors[index].StatModifiers.Count; i++)
            {
                characterStatController.StatController.RemoveStat(new Stat(armors[index].StatModifiers[i].StatName, armors[index].StatModifiers[i].StatValue), armors[index].StatModifiers[i].ModifierType);
            }
            ArmorData res = armors[index];
            armors[index] = null;
            return res;
        }
Exemple #4
0
 // a refaire si je fais un vrai jeu
 public void DrawCharacterStatPreview(ArmorData armorData)
 {
     for (int i = 0; i < stat.Count; i++)
     {
         textNewStat[i].text = ((int)(previewCharacterStat.GetValue(stat[i]) * statMultiplier[i])).ToString();
         textNewStat[i].color = Color.white;
         for (int j = 0; j < armorData.StatModifiers.Count; j++)
         {
             if (stat[i] == armorData.StatModifiers[j].StatName)
             {
                 textNewStat[i].color = Color.yellow;
                 if (armorData.StatModifiers[j].ModifierType == StatModifierType.Flat)
                     textNewStat[i].text = ((int)((previewCharacterStat.GetValue(stat[i]) + armorData.StatModifiers[j].StatValue) * statMultiplier[i])).ToString();
                 else
                     textNewStat[i].text = ((int)((previewCharacterStat.GetValue(stat[i]) * armorData.StatModifiers[j].StatValue) * statMultiplier[i])).ToString();
                 break;
             }
         }
     }
 }
Exemple #5
0
 public void RemoveItem()
 {
     ArmorData removedItem = partyData.CharacterEquipement[indexCharacterSelection].RemoveArmor(equipementListDrawer.IndexSelection);
     if (removedItem != null)
         partyData.Inventory.Add(removedItem.name);
 }