Additional Levels added. Mostly just base artwork so far.
This commit is contained in:
@@ -1,7 +1,70 @@
|
||||
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 Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General
|
||||
{
|
||||
public class Fire
|
||||
public class Fire : BaseItem
|
||||
{
|
||||
|
||||
[Header("Flags")]
|
||||
[SerializeField]
|
||||
private LevelFlag _levelFlag;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PlayerManager.CanUseTool(ToolID.WaterBucket))
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user