40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using BriarQueen.Framework.Managers.Levels.Data;
|
|
using BriarQueen.Framework.Managers.UI;
|
|
using Cysharp.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace BriarQueen.Framework.Managers.Player.Data.Codex
|
|
{
|
|
public class CodexTrigger : BaseItem, ICodexTrigger
|
|
{
|
|
[Header("Codex")]
|
|
[SerializeField]
|
|
private CodexEntrySo _codexEntry;
|
|
|
|
[SerializeField]
|
|
private bool _removeTrigger;
|
|
|
|
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
|
|
|
public override string InteractableName =>
|
|
!string.IsNullOrWhiteSpace(InteractableTooltip) ? InteractableTooltip : _codexEntry.Title;
|
|
|
|
public GameObject TriggerObject => GameObject;
|
|
public CodexEntrySo Entry => _codexEntry;
|
|
|
|
public bool RemoveTrigger => _removeTrigger;
|
|
|
|
public override async UniTask OnInteract(ItemDataSo item = null)
|
|
{
|
|
if (!CheckEmptyHands())
|
|
return;
|
|
|
|
PlayerManager.UnlockCodexEntry(_codexEntry);
|
|
|
|
if (_removeTrigger)
|
|
{
|
|
await Remove();
|
|
}
|
|
}
|
|
}
|
|
} |