50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using InfallibleCode;
|
|
using UnityEngine.Events;
|
|
|
|
|
|
namespace TRInventoryUpdatable
|
|
{
|
|
public class DanielsEnvelope : MonoBehaviour, IPickable
|
|
{
|
|
[SerializeField] private UnityEvent eventAfterCollectedDiary;
|
|
[SerializeField] private GameObject diaryGo;
|
|
ExaminableItem examinableItem;
|
|
|
|
private void Start()
|
|
{
|
|
examinableItem = GetComponent<ExaminableItem>();
|
|
}
|
|
|
|
public void Pickup()
|
|
{
|
|
if (InventoryManager.GetInstance().medeaDiary.activeSelf == false)
|
|
{
|
|
RingInventory.GetInstance().AddItemToCollectablesInventory(InventoryManager.GetInstance().medeaDiary.transform);
|
|
InventoryManager.GetInstance().medeaDiary.SetActive(true);
|
|
InventoryManager.GetInstance().SaveTemporarilyDiaryEntryInventoryItemData("medeaDiary", gameObject.name);
|
|
print("Added diary to collectables inventory category");
|
|
//Destroy(diaryGo);
|
|
if (examinableItem != null)
|
|
{
|
|
examinableItem.examineItem.GotItemExitDisplayingItem3d();
|
|
}
|
|
if (eventAfterCollectedDiary != null)
|
|
{
|
|
eventAfterCollectedDiary.Invoke();
|
|
}
|
|
StartCoroutine(DestroyAfterSeconds());
|
|
}
|
|
}
|
|
|
|
IEnumerator DestroyAfterSeconds()
|
|
{
|
|
yield return new WaitForSecondsRealtime(0.1f);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|
|
|