diff --git a/Assets/_DDD/_Addressables/Environments/Prop/Brazier1/Prop_Brazier1.prefab b/Assets/_DDD/_Addressables/Environments/Prop/Brazier1/Prop_Brazier1.prefab index 91dfeb20b..95c5113ed 100644 --- a/Assets/_DDD/_Addressables/Environments/Prop/Brazier1/Prop_Brazier1.prefab +++ b/Assets/_DDD/_Addressables/Environments/Prop/Brazier1/Prop_Brazier1.prefab @@ -348,6 +348,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} insertIndex: -1 addedObject: {fileID: 4895648053684561955} + - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + insertIndex: -1 + addedObject: {fileID: 1633775615311007542} m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} --- !u!1 &1277704713268947483 stripped GameObject: @@ -627,6 +630,19 @@ MonoBehaviour: _outlineSharpness: 8 _currentOutlineType: 0 _currentOpacityMultiplier: 1 +--- !u!114 &1633775615311007542 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1277704713268947483} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 3 --- !u!4 &3654677467368248574 stripped Transform: m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} diff --git a/Assets/_DDD/_Addressables/Environments/Prop/Fried/Prop_Fried.prefab b/Assets/_DDD/_Addressables/Environments/Prop/Fried/Prop_Fried.prefab index fcd871dc5..bdb84a03c 100644 --- a/Assets/_DDD/_Addressables/Environments/Prop/Fried/Prop_Fried.prefab +++ b/Assets/_DDD/_Addressables/Environments/Prop/Fried/Prop_Fried.prefab @@ -229,6 +229,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} insertIndex: -1 addedObject: {fileID: 6199984767033459821} + - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + insertIndex: -1 + addedObject: {fileID: 8977540742820762731} m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} --- !u!1 &4244061870577629946 stripped GameObject: @@ -508,6 +511,19 @@ MonoBehaviour: _outlineSharpness: 8 _currentOutlineType: 0 _currentOpacityMultiplier: 1 +--- !u!114 &8977540742820762731 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4244061870577629946} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 2 --- !u!4 &4499382904539758566 stripped Transform: m_CorrespondingSourceObject: {fileID: 4111453722694982297, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} diff --git a/Assets/_DDD/_Addressables/Environments/Prop/Pot1/Prop_Pot1.prefab b/Assets/_DDD/_Addressables/Environments/Prop/Pot1/Prop_Pot1.prefab index cbc4fc20d..d1f17534a 100644 --- a/Assets/_DDD/_Addressables/Environments/Prop/Pot1/Prop_Pot1.prefab +++ b/Assets/_DDD/_Addressables/Environments/Prop/Pot1/Prop_Pot1.prefab @@ -265,6 +265,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} insertIndex: -1 addedObject: {fileID: 4049645275774486586} + - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + insertIndex: -1 + addedObject: {fileID: 216072919608443244} m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} --- !u!4 &8675645304246391653 stripped Transform: @@ -549,6 +552,19 @@ MonoBehaviour: _outlineSharpness: 8 _currentOutlineType: 0 _currentOpacityMultiplier: 1 +--- !u!114 &216072919608443244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9003538228676253305} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 1 --- !u!1001 &5406243702551518767 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab index f842662b8..07a8b71f5 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: 5 + _availableInteractions: 13 _nearColliders: - {fileID: 0} - {fileID: 0} diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware.meta b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware.meta new file mode 100644 index 000000000..7ee258702 --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 759cab89a413f3e4cb8a9ae2afc2e48a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs new file mode 100644 index 000000000..2c7cd785b --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace DDD.Restaurant +{ + public interface ICookware + { + CookwareType CookwareType { get; } + } + + public class CookwareComponent : MonoBehaviour, ICookware + { + [field: SerializeField] public CookwareType CookwareType { get; private set; } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs.meta new file mode 100644 index 000000000..8fd1f937e --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Environment/Cookware/CookwareComponent.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 51968825b07cc964fafbc62c69322b30 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Cook.cs b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Cook.cs index c599b2af8..b70a77aec 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Cook.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Cook.cs @@ -37,10 +37,5 @@ public virtual bool OnInteracted(IInteractor interactor, ScriptableObject payloa { return true; } - - public ScriptableObject GetPayload() - { - return null; - } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs index 34bb0a1c3..46227d570 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantInteractionComponent.cs @@ -13,7 +13,8 @@ public static class RestaurantInteractionSubsystems { {InteractionType.RestaurantOrder, typeof(InteractionSubsystem_Order)}, {InteractionType.RestaurantManagement, typeof(InteractionSubsystem_Management)}, - {InteractionType.RestaurantMeal, typeof(InteractionSubsystem_Meal)} + {InteractionType.RestaurantMeal, typeof(InteractionSubsystem_Meal)}, + {InteractionType.RestaurantCook, typeof(InteractionSubsystem_Cook)}, }; } diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantCooks/RestaurantCookSolver_OpenCookUi.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantCooks/RestaurantCookSolver_OpenCookUi.cs index 3bcf4f904..55c89e123 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantCooks/RestaurantCookSolver_OpenCookUi.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantCooks/RestaurantCookSolver_OpenCookUi.cs @@ -4,19 +4,37 @@ namespace DDD.Restaurant { public class RestaurantCookSolver_OpenCookUi : MonoBehaviour, IInteractionSubsystemSolver { + private CookwareType _cookwareType; + public bool ExecuteInteractionSubsystem(IInteractor interactor, IInteractable interactable, ScriptableObject payload = null) { if (CanExecuteInteractionSubsystem(interactor, interactable, payload) == false) return false; var evt = GameEvents.OpenPopupUiEvent; evt.UiType = typeof(CookUi); - //evt.Payload = cookwareTypePayload.CookwareType; + evt.Payload = _cookwareType; EventBus.Broadcast(evt); return true; } public bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null) { + _cookwareType = CookwareType.None; + var iCookware = interactable?.GetInteractableGameObject().GetComponent(); + if (iCookware == null) return false; + + var interactableCookwareType = iCookware.CookwareType; + if (DataManager.Instance.GetDataSo().TryGetValueByCookwareType(interactableCookwareType, out var cookwareData) == false) + { + return false; + } + + if (RestaurantState.Instance.ManagementState.HasAddedCookByCookwareKey(cookwareData.Id) == false) + { + return false; + } + + _cookwareType = interactableCookwareType; GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; return currentGameFlowState == GameFlowState.RunRestaurant; } diff --git a/Assets/_DDD/_Scripts/Restaurant/State/FlowStates/RestaurantManagementState.cs b/Assets/_DDD/_Scripts/Restaurant/State/FlowStates/RestaurantManagementState.cs index 1c5befdf7..bb0fb2705 100644 --- a/Assets/_DDD/_Scripts/Restaurant/State/FlowStates/RestaurantManagementState.cs +++ b/Assets/_DDD/_Scripts/Restaurant/State/FlowStates/RestaurantManagementState.cs @@ -254,5 +254,10 @@ public bool IsTodayMenuMatched(string cookwareId) return false; } + + public bool HasAddedCookByCookwareKey(string cookwareKey) + { + return _cookwareToRecipeIds.ContainsKey(cookwareKey) && _cookwareToRecipeIds[cookwareKey].Count > 0;; + } } } \ No newline at end of file