Files
A-Fairytale-Gone-Bad-Briar-…/Assets/Scripts/Framework/Managers/Interaction/Data/BaseInteraction.cs

43 lines
1.4 KiB
C#

using System;
using BriarQueen.Framework.Coordinators.Events;
using BriarQueen.Framework.Managers.Player;
using BriarQueen.Framework.Managers.Player.Data;
using Cysharp.Threading.Tasks;
namespace BriarQueen.Framework.Managers.Interaction.Data
{
/// <summary>
/// Inventory-safe per-item logic. Serialized INSIDE ItemDataSo via SerializeReference.
/// No scene objects required.
/// </summary>
[Serializable]
public abstract class BaseInteraction
{
/// <summary>
/// Called when player uses 'self' on 'other' from the inventory UI.
/// Return true if the interaction was handled (success OR "can't" message shown).
/// Return false if this interaction doesn't apply, so caller may try other routes/fallback.
/// </summary>
public abstract UniTask<bool> TryUseWith(
ItemDataSo self,
ItemDataSo other,
PlayerManager playerManager,
EventCoordinator eventCoordinator);
}
/// <summary>
/// Default "does nothing" interaction.
/// </summary>
[Serializable]
public sealed class NoOpItemInteraction : BaseInteraction
{
public override UniTask<bool> TryUseWith(
ItemDataSo self,
ItemDataSo other,
PlayerManager playerManager,
EventCoordinator eventCoordinator)
{
return UniTask.FromResult(false);
}
}
}