First commit for private source control. Older commits available on Github.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using BriarQueen.Game.Levels.ChapterOne.VillageStreet;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.VillageStreet
|
||||
{
|
||||
public class StreetVines : BaseItem
|
||||
{
|
||||
[SerializeField]
|
||||
private Street _owner;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (_owner == null)
|
||||
{
|
||||
Debug.LogWarning("StreetVines is missing its Street owner.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanUseKnife())
|
||||
{
|
||||
PublishFailureMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(
|
||||
InteractEventIDs.Get(EnvironmentInteractKey.UsingKnife)));
|
||||
|
||||
await _owner.CutVines();
|
||||
}
|
||||
|
||||
private bool CanUseKnife()
|
||||
{
|
||||
if (SettingsService.Game.AutoUseTools)
|
||||
return PlayerManager.HasAccessToTool(ToolID.Knife);
|
||||
|
||||
return PlayerManager.GetEquippedTool() == ToolID.Knife;
|
||||
}
|
||||
|
||||
private void PublishFailureMessage()
|
||||
{
|
||||
var message = SettingsService.Game.AutoUseTools
|
||||
? InteractEventIDs.Get(LevelInteractKey.CutVines)
|
||||
: InteractEventIDs.Get(ItemInteractKey.WrongTool);
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32a79fbd751c4216b83680bbc425cfa7
|
||||
timeCreated: 1773954077
|
||||
Reference in New Issue
Block a user