60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
using BriarQueen.Data.Identifiers;
|
|
using BriarQueen.Data.IO.Saves;
|
|
using BriarQueen.Framework.Events.Gameplay;
|
|
using BriarQueen.Framework.Events.UI;
|
|
using BriarQueen.Framework.Managers.Levels.Data;
|
|
using BriarQueen.Framework.Managers.Player.Data;
|
|
using BriarQueen.Framework.Managers.UI;
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
namespace BriarQueen.Game.Items.Pickups.ChapterOne.LaxleyHouse
|
|
{
|
|
public class MantleClock : BaseItem
|
|
{
|
|
public override UICursorService.CursorStyle ApplicableCursorStyle =>
|
|
HasRetrievedHourHand
|
|
? UICursorService.CursorStyle.Inspect
|
|
: UICursorService.CursorStyle.Pickup;
|
|
|
|
public override string InteractableName => "Broken Mantle Clock";
|
|
|
|
private bool HasRetrievedHourHand =>
|
|
SaveManager.GetLevelFlag(LevelFlag.LaxleyHourHandRetrieved);
|
|
|
|
public override async UniTask OnInteract(ItemDataSo item = null)
|
|
{
|
|
if (!CheckEmptyHands())
|
|
return;
|
|
|
|
if (item != null)
|
|
{
|
|
EventCoordinator.Publish(
|
|
new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
|
return;
|
|
}
|
|
|
|
if (HasRetrievedHourHand)
|
|
{
|
|
EventCoordinator.Publish(
|
|
new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.LaxleyHouseBrokenClock)));
|
|
return;
|
|
}
|
|
|
|
PlayerManager.CollectItem(ItemIDs.Get(ItemKey.LaxleyClockHourHand));
|
|
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.LooksImportant)));
|
|
EventCoordinator.Publish(new SelectedItemChangedEvent(null));
|
|
|
|
await OnInteracted();
|
|
}
|
|
|
|
protected override UniTask OnInteracted()
|
|
{
|
|
if (!HasRetrievedHourHand)
|
|
SaveManager.SetLevelFlag(LevelFlag.LaxleyHourHandRetrieved, true);
|
|
|
|
|
|
|
|
return UniTask.CompletedTask;
|
|
}
|
|
}
|
|
} |