PO/Assets/Inventory/EquipmentInfo.cs

42 lines
1.3 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EquipmentInfo : MonoBehaviour
{
public static EquipmentInfo main;
[SerializeField] private Text localName;
[SerializeField] private Text desqription;
[SerializeField] private Image icon;
[SerializeField] private Button AddButton;
private void Awake()
{
if (main != null && main != this)
{
Debug.LogWarning("2 equipmentinfo on the scene");
Destroy(this);
return;
}
main = this;
}
private void Start()
{
CardAbout(0);
}
public void CardAbout(int _index)
{
localName.text = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.name;
desqription.text = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.description;
icon.sprite = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.sprite;
if (Inventory.main.EquipedOrNot(Inventory.main.lastCardNum))
AddButton.GetComponentInChildren<Text>().text = "UnEquip";
else
AddButton.GetComponentInChildren<Text>().text = "Equip";
}
}