52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
public class RestaurantInteractionComponent : MonoBehaviour, IInteractable
|
|
{
|
|
[SerializeField] private InteractionType _interactionType = InteractionType.None;
|
|
[SerializeField] private float _holdTime = 1f;
|
|
[SerializeField] private string _interactionMessageKey = "";
|
|
|
|
public bool CanInteract()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public bool OnInteracted(IInteractor interactor, ScriptableObject interactionPayloadSo = null)
|
|
{
|
|
if (CanInteract() == false)
|
|
{
|
|
return false;
|
|
}
|
|
bool interactionResult = RestaurantInteractionEvents.RestaurantInteraction.RequestInteraction(interactor.GetInteractorGameObject(),
|
|
GetInteractableGameObject(), GetInteractionType(), interactionPayloadSo, true);
|
|
return interactionResult;
|
|
}
|
|
|
|
public InteractionType GetInteractionType()
|
|
{
|
|
return _interactionType;
|
|
}
|
|
|
|
public GameObject GetInteractableGameObject()
|
|
{
|
|
return gameObject;
|
|
}
|
|
|
|
public void InitializeInteraction(InteractionType interactionType)
|
|
{
|
|
_interactionType = interactionType;
|
|
}
|
|
|
|
public float GetRequiredHoldTime()
|
|
{
|
|
return _holdTime;
|
|
}
|
|
|
|
public string GetInteractionMessageKey()
|
|
{
|
|
return _interactionMessageKey;
|
|
}
|
|
}
|
|
} |