44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using BriarQueen.Data.Identifiers;
|
|
using BriarQueen.Data.IO.Saves;
|
|
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.Environment.ChapterOne.Village
|
|
{
|
|
public class ChainLock : BaseItem
|
|
{
|
|
public override string InteractableName => "Locked Chain";
|
|
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
|
|
|
public override async UniTask OnInteract(ItemDataSo item = null)
|
|
{
|
|
if (!CheckEmptyHands())
|
|
return;
|
|
|
|
if (item == null)
|
|
{
|
|
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.PumphouseChain)));
|
|
return;
|
|
}
|
|
|
|
if (item.UniqueID != ItemIDs.Pickups[ItemKey.PumphouseKey])
|
|
{
|
|
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
|
return;
|
|
}
|
|
|
|
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.UnlockedPumphouse)));
|
|
await Remove();
|
|
}
|
|
|
|
protected override UniTask OnRemoved()
|
|
{
|
|
SaveManager.SetLevelFlag(LevelFlag.PumpHouseOpened, true);
|
|
PlayerManager.RemoveItem(ItemIDs.Pickups[ItemKey.PumphouseKey]);
|
|
return UniTask.CompletedTask;
|
|
}
|
|
}
|
|
} |