private void LoadEquipment(SaveData data) { foreach (EquipmentData equipmentData in data.MyEquipmentData) { EquipmentButton eb = Array.Find(equipment, x => x.name == equipmentData.MyType); eb.EquipArmor(Array.Find(items, x => x.MyTitle == equipmentData.MyTitle) as Armor); } }
public void EquipArmor(Armor armor) { switch (armor.MyArmorType) { case ArmorType.Helmet: helmet.EquipArmor(armor); break; case ArmorType.Neckless: neckless.EquipArmor(armor); break; case ArmorType.Ring: ring1.EquipArmor(armor); break; case ArmorType.Weapon: weapon.EquipArmor(armor); break; case ArmorType.Shield: shield.EquipArmor(armor); break; case ArmorType.Upper: upper.EquipArmor(armor); break; case ArmorType.Lower: lower.EquipArmor(armor); break; case ArmorType.Gloves: gloves.EquipArmor(armor); break; case ArmorType.Shoes: shoes.EquipArmor(armor); break; } }