54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Assets.Scripts
|
|
{
|
|
public class InventoryTrash : MonoBehaviour
|
|
{
|
|
public Texture close;
|
|
public Texture open;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void onMouseEnter()
|
|
{
|
|
gameObject.GetComponent<RawImage>().texture = open;
|
|
}
|
|
|
|
public void onMouseLeave()
|
|
{
|
|
gameObject.GetComponent<RawImage>().texture = close;
|
|
}
|
|
|
|
public void deleteItem()
|
|
{
|
|
InventorySlot toDelete = GameObject.Find("Inventory").GetComponent<Inventory>().getDrag().GetComponent<InventorySlot>();
|
|
if (toDelete.place == ItemPlace.BAG)
|
|
{
|
|
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("collect", toDelete.getItem(toDelete.getCurrentBag()), -1);
|
|
toDelete.removeItem();
|
|
}
|
|
else
|
|
{
|
|
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("collect", toDelete.getEquip(), -1);
|
|
toDelete.removeEquip();
|
|
}
|
|
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.GetComponent<RawImage>().color = new Color(0, 0, 0, 0);
|
|
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.GetComponent<RawImage>().texture = null;
|
|
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.transform.position = new Vector3(0, 0, 0);
|
|
}
|
|
}
|
|
}
|