45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace TRInventoryUpdatable
|
|
{
|
|
public class DiaryInventoryItem : MonoBehaviour, InventoryUpdatable, IUsable
|
|
{
|
|
[SerializeField] private Animator diaryPivotAnimator;
|
|
[SerializeField] private Animator diaryAnimator;
|
|
|
|
[Tooltip("The name of the diary (This is being updated in the UI of the inventory where the text for the name is)")]
|
|
public string diaryName;
|
|
[Tooltip("The Description of the diary")]
|
|
public string diaryDescription;
|
|
[Tooltip("The State that the collectables need to go to after the player presses the button to USE the Diary")]
|
|
public string inventoryCollectablesMenuStateName;
|
|
|
|
public void InventoryUpdate()
|
|
{
|
|
InventoryManager.GetInstance().ringInventoryGear.itemName.text = diaryName;
|
|
InventoryManager.GetInstance().ringInventoryGear.itemDescription.text = diaryDescription;
|
|
}
|
|
|
|
public void Use()
|
|
{
|
|
//Change state according to the diary that the is being used:
|
|
//InventoryCollectablesMenuManager.GetInstance().UpdateCollectableMenuStateByName(inventoryCollectablesMenuStateName);
|
|
//InventoryManager.GetInstance().GoToCollectablesMenuState();
|
|
//InventoryCollectablesMenuManager.GetInstance().UpdateCollectablesMenu();
|
|
StartCoroutine(OpenDiary());
|
|
}
|
|
|
|
IEnumerator OpenDiary()
|
|
{
|
|
diaryPivotAnimator.SetTrigger("InventoryItemFaceScreen");
|
|
diaryAnimator.SetBool("IsOpen",true);
|
|
yield return new WaitForSecondsRealtime(1f);
|
|
InventoryCollectablesMenuManager.GetInstance().UpdateCollectableMenuStateByName(inventoryCollectablesMenuStateName);
|
|
InventoryManager.GetInstance().GoToCollectablesMenuState();
|
|
InventoryCollectablesMenuManager.GetInstance().UpdateCollectablesMenu();
|
|
}
|
|
}
|
|
}
|