PO/Assets/Scripts/MainMenuScripts/AddEquipment.cs

34 lines
1.3 KiB
C#

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