using System.Collections; using System.Collections.Generic; using UnityEngine; public class AddEquipment : MonoBehaviour { public void AddOrRemove() { if (Inventory.main.EquipedOrNot(Inventory.main.lastCardNum)) { Inventory.main.playerEquipment.Remove(Inventory.main.allEquipment[Inventory.main.lastCardNum]); for (int i = 0; i < Inventory.main.playerPlace.Count; i++) { if (Inventory.main.playerPlace[i].name == Inventory.main.allEquipment[Inventory.main.lastCardNum].GetComponent().equipmentConfig.equipmentCharacteristics.place.ToString()) { Inventory.main.playerPlace[i].image.sprite = Inventory.main.imagePlug; Inventory.main.playerPlace[i].GetComponent().equipmentNum = -1; Inventory.main.localplayerEquipment.Add(Inventory.main.allEquipment[Inventory.main.lastCardNum]); Inventory.main.gameObject.GetComponent().InstantiateEquipmentButton(0, 9); } } } else { Inventory.main.playerEquipment.Add(Inventory.main.allEquipment[Inventory.main.lastCardNum]); Inventory.main.WhichPlace(Inventory.main.lastCardNum); Inventory.main.localplayerEquipment.Remove(Inventory.main.allEquipment[Inventory.main.lastCardNum]); Inventory.main.gameObject.GetComponent().InstantiateEquipmentButton(0, 9); } DataHolder.main.PlayerEquipment = Inventory.main.playerEquipment; EquipmentInfo.main.CardAbout(Inventory.main.lastCardNum); } }