Restructured for new direction.
This commit is contained in:
@@ -19,7 +19,7 @@ namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
private AssetItemKey _bookAssetID;
|
||||
|
||||
[SerializeField]
|
||||
private BookEntryID _bookEntryID;
|
||||
private DocumentEntryID _documentEntryID;
|
||||
|
||||
[Header("Book Interface")]
|
||||
[SerializeField]
|
||||
@@ -58,7 +58,11 @@ namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
if (bookObj == null) return;
|
||||
|
||||
_bookInterface = bookObj.GetComponent<BookInterface>();
|
||||
if (_bookInterface == null) return;
|
||||
if (_bookInterface == null)
|
||||
{
|
||||
await DestructionService.Destroy(bookObj);
|
||||
return;
|
||||
}
|
||||
|
||||
_bookInterface.CanvasGroup.alpha = 0f;
|
||||
_bookInterface.CanvasGroup.blocksRaycasts = false;
|
||||
@@ -99,7 +103,7 @@ namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
|
||||
private void UnlockCodexEntry()
|
||||
{
|
||||
PlayerManager.UnlockCodexEntry(CodexEntryIDs.Get(_bookEntryID));
|
||||
PlayerManager.UnlockCodexEntry(CodexEntryIDs.Get(_documentEntryID));
|
||||
}
|
||||
|
||||
public async UniTask CloseBookInterface()
|
||||
@@ -144,4 +148,4 @@ namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
_displayCts = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace BriarQueen.Game.Items.Environment.General
|
||||
private bool _removeTrigger;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
public override string InteractableName => InteractableTooltip;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
@@ -30,4 +31,4 @@ namespace BriarQueen.Game.Items.Environment.General
|
||||
await Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
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;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General
|
||||
{
|
||||
public class Fire : BaseItem
|
||||
{
|
||||
[Header("Flags")]
|
||||
[SerializeField]
|
||||
private LevelFlag _levelFlag;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Interact;
|
||||
|
||||
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PlayerManager.CanUseTool(ToolID.EndlessGoblet))
|
||||
{
|
||||
PublishFailureMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.ExtinguishFire)));
|
||||
await Remove();
|
||||
}
|
||||
|
||||
protected override UniTask OnRemoved()
|
||||
{
|
||||
SaveManager.SetLevelFlag(_levelFlag, true);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private void PublishFailureMessage()
|
||||
{
|
||||
var autoUseTools = SettingsService != null &&
|
||||
SettingsService.Game != null &&
|
||||
SettingsService.Game.AutoUseTools;
|
||||
|
||||
var equippedTool = PlayerManager.GetEquippedTool();
|
||||
|
||||
string message;
|
||||
|
||||
if (equippedTool == ToolID.None)
|
||||
{
|
||||
message = InteractEventIDs.Get(EnvironmentInteractKey.FireHot);
|
||||
}
|
||||
else if (autoUseTools)
|
||||
{
|
||||
// In auto-use mode, reaching this point means the player does not have access
|
||||
// to the required tool at all, so this should still read like a generic failure.
|
||||
message = InteractEventIDs.Get(EnvironmentInteractKey.FireHot);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Auto-use is disabled, and the player has some tool equipped that is not valid.
|
||||
message = InteractEventIDs.Get(ItemInteractKey.WrongTool);
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 559782186ce043e8b38b0f4517dfbddc
|
||||
timeCreated: 1774552750
|
||||
@@ -1,82 +0,0 @@
|
||||
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;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General
|
||||
{
|
||||
public class TwistingVines : BaseItem
|
||||
{
|
||||
[Header("Flags")]
|
||||
[SerializeField]
|
||||
private LevelFlag _levelFlag;
|
||||
|
||||
public override string InteractableName => "Twisting Vines";
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(
|
||||
new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanUseKnife())
|
||||
{
|
||||
PublishFailureMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(
|
||||
new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.UsingKnife)));
|
||||
|
||||
await Remove();
|
||||
}
|
||||
|
||||
protected override UniTask OnRemoved()
|
||||
{
|
||||
SaveManager.SetLevelFlag(_levelFlag, true);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private bool CanUseKnife()
|
||||
{
|
||||
return PlayerManager.CanUseTool(ToolID.Knife);
|
||||
}
|
||||
|
||||
private void PublishFailureMessage()
|
||||
{
|
||||
var autoUseTools = SettingsService != null &&
|
||||
SettingsService.Game != null &&
|
||||
SettingsService.Game.AutoUseTools;
|
||||
|
||||
var equippedTool = PlayerManager.GetEquippedTool();
|
||||
|
||||
string message;
|
||||
|
||||
if (equippedTool == ToolID.None)
|
||||
{
|
||||
message = InteractEventIDs.Get(LevelInteractKey.CutVines);
|
||||
}
|
||||
else if (autoUseTools)
|
||||
{
|
||||
// In auto-use mode, reaching this point means the player does not have access
|
||||
// to the required tool at all, so this should still read like a generic failure.
|
||||
message = InteractEventIDs.Get(LevelInteractKey.CutVines);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Auto-use is disabled, and the player has some tool equipped that is not valid.
|
||||
message = InteractEventIDs.Get(ItemInteractKey.WrongTool);
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 716b29e16fd1452b87eaf8903c0275a0
|
||||
timeCreated: 1770982267
|
||||
Reference in New Issue
Block a user