diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab index 47957a986..9607894d8 100644 --- a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab @@ -426,7 +426,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3} m_Name: m_EditorClassIdentifier: - _availableInteractions: 15 + _availableInteractions: 31 _nearColliders: - {fileID: 0} - {fileID: 0} diff --git a/Assets/_DDD/_Scripts/Game/GameEvent/IInteractable.cs b/Assets/_DDD/_Scripts/Game/GameEvent/IInteractable.cs index 834137f1f..554e04006 100644 --- a/Assets/_DDD/_Scripts/Game/GameEvent/IInteractable.cs +++ b/Assets/_DDD/_Scripts/Game/GameEvent/IInteractable.cs @@ -12,6 +12,7 @@ public enum InteractionType : uint RestaurantManagement = 1u << 0, RestaurantOrder = 1u << 1, RestaurantCook = 1u << 3, + RestaurantTrash = 1u << 4, All = 0xFFFFFFFFu } diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/Core/CharacterCarrier.cs b/Assets/_DDD/_Scripts/Restaurant/Character/Core/CharacterCarrier.cs index 52a52bb19..2eebd066f 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/Core/CharacterCarrier.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/Core/CharacterCarrier.cs @@ -17,7 +17,7 @@ public interface ICarrier bool IsCarrying(); bool CanCarryTo(ICarriable carriable); void Carry(ICarriable carriable); - void Use(ICarriable carriable); + void Use(); } public interface ICarriable @@ -78,7 +78,7 @@ public void Carry(ICarriable carriable) EventBus.Broadcast(evt); } - public void Use(ICarriable carriable) + public void Use() { _currentCarriable = null; _speechBubble?.Hide(); diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Order.cs b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Order.cs index 2137531cb..c60ffa1a4 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Order.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Order.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using Sirenix.Serialization; using UnityEngine; using UnityEngine.Serialization; @@ -49,7 +51,7 @@ public class InteractionSubsystem_Order : MonoBehaviour, IInteractionSubsystemOb { [SerializeField] private RestaurantOrderType _currentRestaurantOrderType = RestaurantOrderType.Wait; [SerializeField] private RestaurantOrderObjectState _orderObjectState = new(); - + public bool CanInteract() { if (GetInteractionSubsystemType() == RestaurantOrderType.Wait) diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs index 25b408a71..6196f5546 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs @@ -134,16 +134,41 @@ private bool TryGetSubsystem(InteractionType interactionType, out IInteractionSu return _subsystems.TryGetValue(interactionType, out subsystem); } + private bool FindCurrentInteractionDataEntry(out InteractionDataEntry interactionDataEntry) + { + string interactionType = _interactionType.ToString(); + string subsystemType = string.Empty; + if (HasSubsystem(_interactionType) && GetSubsystem(_interactionType) != null) + { + subsystemType = GetSubsystem(_interactionType).GetCurrentSubsystemTypeName(); + } + + bool dataFound = DataManager.Instance.GetDataAsset().TryGetValueByTypeName(interactionType, + subsystemType, out interactionDataEntry); + if (!dataFound) + { + interactionDataEntry = new InteractionDataEntry(); + } + return dataFound; + } + // 새로운 스트럭트 기반 메서드들 public virtual InteractionExecutionParameters GetExecutionParameters() { + bool dataFound = FindCurrentInteractionDataEntry(out var interactionDataEntry); + if (!dataFound) + { + return new InteractionExecutionParameters(); + } + + _executionParameters = new InteractionExecutionParameters(interactionDataEntry.HoldTime); return _executionParameters; } public virtual InteractionDisplayParameters GetDisplayParameters() { - if (DataManager.Instance.GetDataAsset().TryGetValueByTypeName(_interactionType.ToString(), - _subsystems[_interactionType].GetCurrentSubsystemTypeName(), out var interactionDataEntry) == false) + bool dataFound = FindCurrentInteractionDataEntry(out var interactionDataEntry); + if (!dataFound) { return new InteractionDisplayParameters(); } diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionEvents.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionEvents.cs index ede0745b1..d7d27db30 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionEvents.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionEvents.cs @@ -11,7 +11,8 @@ public static class RestaurantInteractionEventSolvers { {InteractionType.RestaurantManagement, typeof(RestaurantManagementSolver)}, {InteractionType.RestaurantOrder, typeof(RestaurantOrderSolver)}, - {InteractionType.RestaurantCook, typeof(RestaurantCookSolver)} + {InteractionType.RestaurantCook, typeof(RestaurantCookSolver)}, + {InteractionType.RestaurantTrash, typeof(RestaurantTrashSolver)} }; public static readonly Dictionary TypeToPlayerSolver = new() { diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Dirty.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Dirty.cs index 3dfb82c33..42e3db8ad 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Dirty.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Dirty.cs @@ -11,6 +11,11 @@ public override bool ExecuteInteractionSubsystem(IInteractor interactor, IIntera public override bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null) { + // Check carrying state + var carrier = interactor?.GetInteractorGameObject()?.GetComponent(); + if (carrier != null) + return !carrier.IsCarrying(); + return true; } } diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Serve.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Serve.cs index 351c6749b..784c619cf 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Serve.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantOrders/RestaurantOrderSolver_Serve.cs @@ -18,7 +18,7 @@ public override bool ExecuteInteractionSubsystem(IInteractor interactor, IIntera bool result = base.ExecuteInteractionSubsystem(interactor, interactable, payload); // ExecuteInteractionSubsystem 이후에 음식 제거 - 미리 제거하면 CanExecute 통과 못 함 - carrier.Use(carrier.GetCurrentCarriable()); + carrier.Use(); // OnFoodServed (Consume Bill Hud item) RestaurantOrderEvent evt = new RestaurantOrderEvent diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs index 499c8f295..927a144cb 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs @@ -92,9 +92,8 @@ protected override int GetDisplayLayer() } else { - return LayerMask.NameToLayer(LayerConstants.WorldUi); + return base.GetDisplayLayer(); } - return base.GetDisplayLayer(); } } } \ No newline at end of file