diff --git a/Assets/AddressableAssetsData/AssetGroups/Group.asset b/Assets/AddressableAssetsData/AssetGroups/Group.asset index b13bd65c2..f95f579da 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Group.asset @@ -1,3 +1,245 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3} + m_Name: Group + m_EditorClassIdentifier: + m_GroupName: Group + m_GUID: 30e7f67fe9aaa7849a34c9b6e2bc53ae + m_SerializeEntries: + - m_GUID: 01b8de2498ebb6a49843147da99a3c8d + m_Address: RestaurantManagementUi + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 034ac52b4c3fe854193b7c9c2d353be5 + m_Address: Foods + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 077fbb30d2367574db4211e2945acda0 + m_Address: TodayMenuSlotUi + m_ReadOnly: 0 + m_SerializedLabels: + - AnimatorController + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 0912c3de85fd61848a41575faa2794ed + m_Address: CreateEnvironmentSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 0e912dc7ded8c2449bc4d0e2bbf1d2bf + m_Address: BaseRestaurantEnvironment + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 2007acba03804024a801aee30991e439 + m_Address: Ingredients + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 2986d47c2acd84257866fc5e3180f833 + m_Address: BarrelTestTile + m_ReadOnly: 0 + m_SerializedLabels: + - Material + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 29d0dee3b70fbc44d992ea47012bc366 + m_Address: InventoryTestDataSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 29dcda970aef9584d9b157e766b8a278 + m_Address: RestaurantPlayer + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 2eb88deceda8c443db7ec557aaef30af + m_Address: Entry + m_ReadOnly: 0 + m_SerializedLabels: + - Scene + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 3d9cd4966de6ad949b6c2f3289f681ce + m_Address: CustomerNpc + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 422e501a9731145439708c6759c8c546 + m_Address: Coral_SkeletonData + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 43d183a6e5f0da746b6dbe4b447caa9e + m_Address: RestaurantProps + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 46dd69de07b704843a8c376995da2eb5 + m_Address: FoodBarrelTestFood + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 47e757b9a170ab649af14c4d7b80ac41 + m_Address: CreateRestaurantPlayerSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 700b1d73671ee424dadd18a1443e7b7b + m_Address: BarrelTestProp + m_ReadOnly: 0 + m_SerializedLabels: + - Material + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 79f90744c9c7ada498ba1ee8c60272d3 + m_Address: Common + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 7a110f482049d4062b4545dc94852fea + m_Address: PropBarrelTestProp + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 7d5defa51c3d6764ca544d54592fdb47 + m_Address: RestaurantManagementUi_OnlyAtlas + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 8073fcaf56fc7c34e996d0d47044f146 + m_Address: RestaurantManagementUi_RestaurantUiActions_InputBindingSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 83afdd7c8e0232443a83b09a90d0d3b1 + m_Address: InventorySlotUi + m_ReadOnly: 0 + m_SerializedLabels: + - AnimatorController + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 8c4fcb278b09f944cbfa342ace27fcd4 + m_Address: RestaurantManagementSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 91f41ed6ea0600f4abed98cf0bf53bc5 + m_Address: Drinks + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 99d3d87bd43df65488e757c43a308f36 + m_Address: ConfirmUi_RestaurantUiActions_InputBindingSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: a60e7a432b7eb65419f3942f4f422fb4 + m_Address: Voyage + m_ReadOnly: 0 + m_SerializedLabels: + - Scene + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: be3e2271305612d4ab3277c241ffe629 + m_Address: Restaurant2 + m_ReadOnly: 0 + m_SerializedLabels: + - Scene + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: c6d19267dabc844449cc778f2f03fb34 + m_Address: SummerGrass01_SkeletonData + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: cd49da51493584ecf98e21cd4eeb3e2b + m_Address: TileBarrelTestTile + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: ceeea618d8ee23642a0e56b3f963448c + m_Address: RestaurantNpc + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: d11d5cf80be02d7469f07db925af284a + m_Address: TabButtonUi + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: d530c37d61295a6498a34f20e4a70bee + m_Address: Cookwares + m_ReadOnly: 0 + m_SerializedLabels: + - Atlas + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: ddb0db863be8f254bb8a8f07d39a960e + m_Address: RestaurantPlayerDataSo + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: de073d0136201ac4cbb36dbeb4b76fb2 + m_Address: Restaurant + m_ReadOnly: 0 + m_SerializedLabels: + - Scene + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: e349efbef7b74ce47af461f7985bfdc2 + m_Address: ItemSlotUi + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: efc890589b4c46948885cd750384bc6f + m_Address: BasePropSpriteMaterial + m_ReadOnly: 0 + m_SerializedLabels: + - Material + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: f28a226717a80c9408dc27c756ce6e2f + m_Address: KeySlot + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: f9bb25b96d102c34ea2088901e9815df + m_Address: TasteHashTagSlotUi + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: ff07d58cdb81fca4f80b04a12d40d7d9 + m_Address: CheckListSlot + m_ReadOnly: 0 + m_SerializedLabels: + - Prefab + FlaggedDuringContentUpdateRestriction: 0 + m_ReadOnly: 0 + m_Settings: {fileID: 11400000, guid: d12ffbb6f886d48418efb0b6d15ccb88, type: 2} + m_SchemaSet: + m_Schemas: + - {fileID: 11400000, guid: 7e7c84ad73aefe14a8fe3acef1a1ef70, type: 2} + - {fileID: 11400000, guid: 446e71e39fbb9cc41bd76f6e78ea5347, type: 2} version https://git-lfs.github.com/spec/v1 oid sha256:cd29c0cce014cb55723256f66659694982df2c6df9db2e3d31c876b405d138f7 size 9353 diff --git a/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset b/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset new file mode 100644 index 000000000..dc12e9ef2 --- /dev/null +++ b/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset @@ -0,0 +1,32 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b23f08d2ae4cba14087c1ed36193d82b, type: 3} + m_Name: Customer + m_EditorClassIdentifier: + mBehaviorSource: + behaviorName: Behavior + behaviorDescription: + mTaskData: + types: [] + parentIndex: + startIndex: + variableStartIndex: + JSONSerialization: '{}' + fieldSerializationData: + typeName: [] + fieldNameHash: + startIndex: + dataPosition: + unityObjects: [] + byteData: + byteDataArray: + Version: 1.7.12 diff --git a/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset.meta b/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset.meta new file mode 100644 index 000000000..dede6c150 --- /dev/null +++ b/Assets/_DDD/Restaurant/Characters/Npcs/Customers/Customer.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5b1a44992dce884984324332f431454 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab b/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab index fa14945d9..6b20ad462 100644 --- a/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab +++ b/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab @@ -93,6 +93,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3} m_Name: m_EditorClassIdentifier: - _interactionType: 1 + _interactionType: 2 _holdTime: 1.3 _interactionMessageKey: Test diff --git a/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab b/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab index c2d555fa4..f2ce04cce 100644 --- a/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab +++ b/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab @@ -358,10 +358,33 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} insertIndex: -1 addedObject: {fileID: 7159781468411195695} - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + insertIndex: -1 + addedObject: {fileID: 5123936106469897444} m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} --- !u!4 &6689525833630355058 stripped Transform: m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} m_PrefabInstance: {fileID: 4777358697124966162} m_PrefabAsset: {fileID: 0} +--- !u!1 &9211739394093953175 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + m_PrefabInstance: {fileID: 4777358697124966162} + m_PrefabAsset: {fileID: 0} +--- !u!114 &5123936106469897444 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9211739394093953175} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3} + m_Name: + m_EditorClassIdentifier: + _interactionType: 1 + _holdTime: 1 + _interactionMessageKey: Test diff --git a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab new file mode 100644 index 000000000..fc4907885 --- /dev/null +++ b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab @@ -0,0 +1,75 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &6675463944788402332 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: externalBehavior + value: + objectReference: {fileID: 11400000, guid: b5b1a44992dce884984324332f431454, type: 2} + - target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: mBehaviorSource.behaviorName + value: Customer + objectReference: {fileID: 0} + - target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: mBehaviorSource.mTaskData.Version + value: 1.7.12 + objectReference: {fileID: 0} + - target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: mBehaviorSource.mTaskData.JSONSerialization + value: '{}' + objectReference: {fileID: 0} + - target: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_Name + value: CustomerNpc + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} diff --git a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab.meta b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab.meta new file mode 100644 index 000000000..ee976fbfd --- /dev/null +++ b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3d9cd4966de6ad949b6c2f3289f681ce +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab new file mode 100644 index 000000000..de87b71ab --- /dev/null +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab @@ -0,0 +1,247 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &3417590820015712106 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 500600556154722887, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: _initialSkinName + value: Casper + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_Name + value: RestaurantNpc + objectReference: {fileID: 0} + - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: m_Materials.Array.size + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: b5430080246bbb048b939d6a0a5621cd, type: 2} + - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: 'm_Materials.Array.data[1]' + value: + objectReference: {fileID: 2100000, guid: d018debe5b8bedf4c8f19cba9e4facec, type: 2} + - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: 'm_Materials.Array.data[2]' + value: + objectReference: {fileID: 2100000, guid: 0bc9c8216989ef64ab468d6aa08cca35, type: 2} + - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: 'm_Materials.Array.data[3]' + value: + objectReference: {fileID: 2100000, guid: d018debe5b8bedf4c8f19cba9e4facec, type: 2} + m_RemovedComponents: + - {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: 3 + addedObject: {fileID: 8165702938223525558} + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: 4 + addedObject: {fileID: 5654854357519457123} + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: 5 + addedObject: {fileID: 325877664603524396} + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: 6 + addedObject: {fileID: 6826437533270866908} + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: -1 + addedObject: {fileID: 8626078465432105892} + m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} +--- !u!1 &7462519206451630147 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + m_PrefabInstance: {fileID: 3417590820015712106} + m_PrefabAsset: {fileID: 0} +--- !u!114 &8165702938223525558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462519206451630147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 373b52eb9bf8c40f785bb6947a1aee66, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1073741824 + drawGizmos: 1 + detailedGizmos: 0 + startEndModifier: + addPoints: 0 + exactStartPoint: 3 + exactEndPoint: 3 + useRaycasting: 0 + mask: + serializedVersion: 2 + m_Bits: 4294967295 + useGraphRaycasting: 0 + traversableTags: -1 + tagPenalties: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + graphMask: + value: 1 +--- !u!114 &5654854357519457123 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462519206451630147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f6eb1402c17e84a9282a7f0f62eb584f, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1073741824 + radius: 0.25 + height: 0.5 + canMove: 1 + maxSpeed: 2 + gravity: {x: NaN, y: NaN, z: NaN} + groundMask: + serializedVersion: 2 + m_Bits: 4294967295 + endReachedDistance: 0.2 + whenCloseToDestination: 0 + rvoDensityBehavior: + enabled: 1 + densityThreshold: 0.5 + returnAfterBeingPushedAway: 0 + progressAverage: 0 + lastJobDensityResult: 0 + repathRateCompatibility: NaN + canSearchCompability: 0 + orientation: 0 + enableRotation: 0 + autoRepath: + mode: 2 + period: 0.5 + sensitivity: 10 + maximumPeriod: 2 + visualizeSensitivity: 0 + maxAcceleration: -2.5 + rotationSpeed: 360 + slowdownDistance: 1 + pickNextWaypointDist: 0.2 + alwaysDrawGizmos: 0 + slowWhenNotFacingTarget: 1 + preventMovingBackwards: 0 + constrainInsideGraph: 0 +--- !u!114 &325877664603524396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462519206451630147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 77f586f285b3847808d79083bd19ef1f, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1073741824 + quality: 0 + splitAtEveryPortal: 0 + accountForGridPenalties: 0 +--- !u!114 &6826437533270866908 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462519206451630147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8d7b55c7ecdb49a4a89fa5e6f9022861, type: 3} + m_Name: + m_EditorClassIdentifier: + startWhenEnabled: 0 + asynchronousLoad: 0 + pauseWhenDisabled: 0 + restartWhenComplete: 0 + logTaskChanges: 0 + group: 0 + resetValuesOnRestart: 0 + externalBehavior: {fileID: 0} + mBehaviorSource: + behaviorName: Behavior + behaviorDescription: + mTaskData: + types: [] + parentIndex: + startIndex: + variableStartIndex: + JSONSerialization: + fieldSerializationData: + typeName: [] + fieldNameHash: + startIndex: + dataPosition: + unityObjects: [] + byteData: + byteDataArray: + Version: + gizmoViewMode: 2 + showBehaviorDesignerGizmo: 1 +--- !u!114 &8626078465432105892 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462519206451630147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8bb787bf70c7c134d9a6a049beb7f66a, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab.meta b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab.meta new file mode 100644 index 000000000..92b055a42 --- /dev/null +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ceeea618d8ee23642a0e56b3f963448c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab index eff7af85e..bafd45c81 100644 --- a/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantPlayer.prefab @@ -250,6 +250,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 500600556154722887, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + propertyPath: _initialSkinName + value: Basic + objectReference: {fileID: 0} - target: {fileID: 1111036208394089843, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} propertyPath: m_LocalScale.x value: 2 @@ -353,6 +357,7 @@ PrefabInstance: m_RemovedComponents: - {fileID: 3365694194251356714, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} - {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + - {fileID: 7606279200344222219, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: - targetCorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} @@ -373,7 +378,7 @@ PrefabInstance: addedObject: {fileID: 5643954521731085080} - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} insertIndex: -1 - addedObject: {fileID: 1115647804376030753} + addedObject: {fileID: 388082324973004231} m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} --- !u!1 &7316134055819320434 stripped GameObject: @@ -416,7 +421,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d4e8820e36cdbec4fb86f9bc0e3fd638, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1115647804376030753 +--- !u!114 &388082324973004231 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -425,17 +430,20 @@ MonoBehaviour: m_GameObject: {fileID: 7316134055819320434} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6d7e5480ae1ebf54b8537ad2a08696d2, type: 3} + m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3} m_Name: m_EditorClassIdentifier: - _originalMaterial: {fileID: 2100000, guid: 288333d9c9df2d84cadf3b48d918ebdb, type: 2} - _replacementMaterial: {fileID: 0} - _isSkinSet: 1 - _initialSkinName: Basic - _isRandomSkin: 0 - _isRandomRange: 0 - _randomRange: {x: 0, y: 0} - _randomStrings: [] + _nearColliders: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} --- !u!4 &7511707580127947132 stripped Transform: m_CorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab index fcc593f36..27469bbe8 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab +++ b/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab @@ -47,6 +47,7 @@ GameObject: - component: {fileID: 127430239903465757} - component: {fileID: 3095965496140440094} - component: {fileID: 7606279200344222219} + - component: {fileID: 500600556154722887} m_Layer: 0 m_Name: BaseRestaurantCharacter m_TagString: Untagged @@ -177,6 +178,26 @@ MonoBehaviour: - {fileID: 0} - {fileID: 0} - {fileID: 0} +--- !u!114 &500600556154722887 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5259510642736920361} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6d7e5480ae1ebf54b8537ad2a08696d2, type: 3} + m_Name: + m_EditorClassIdentifier: + _originalMaterial: {fileID: 0} + _replacementMaterial: {fileID: 0} + _isSkinSet: 1 + _initialSkinName: default + _isRandomSkin: 0 + _isRandomRange: 0 + _randomRange: {x: 0, y: 0} + _randomStrings: [] --- !u!1 &6791841979869644848 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab index de6b168dd..f87a2251a 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab +++ b/Assets/_DDD/_ScriptAssets/Prefabs/UiManager.prefab @@ -922,7 +922,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Navigation: - m_Mode: 3 + m_Mode: 0 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} diff --git a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs index 364e9580a..50aa2a319 100644 --- a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs +++ b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs @@ -98,7 +98,7 @@ public class TodayMenuAddedEvent : IEvent {} public class TodayMenuRemovedEvent : IEvent { - public RecipeType RecipeType; + public InventoryCategoryType InventoryCategoryType; } #endregion diff --git a/Assets/_DDD/_Scripts/GameEvent/IInteractable.cs b/Assets/_DDD/_Scripts/GameEvent/IInteractable.cs index e24b03898..dbb465fa8 100644 --- a/Assets/_DDD/_Scripts/GameEvent/IInteractable.cs +++ b/Assets/_DDD/_Scripts/GameEvent/IInteractable.cs @@ -4,8 +4,9 @@ namespace DDD { public enum InteractionType { - None, + None = 0, RestaurantManagementUi, + OpenRestaurant, Count } public interface IInteractable @@ -26,5 +27,6 @@ public interface IInteractor public interface IInteractionSolver { bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null); + bool CanExecuteInteraction(); } } diff --git a/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs b/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs index 2a1bf989c..3f40aad3d 100644 --- a/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs +++ b/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs @@ -1,5 +1,5 @@ -using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Sirenix.OdinInspector; using UnityEngine; @@ -11,8 +11,6 @@ public class RestaurantManagementSo : GameFlowTask { // TODO : 체크리스트 기능 - // TODO : 조리도구 등록, 해제 기능 - public ItemSlotUi ItemSlotUiPrefab; [Title("선택된 메뉴 상세 내용")] @@ -29,30 +27,47 @@ public class RestaurantManagementSo : GameFlowTask [ReadOnly, ShowInInspector] private Dictionary _todayFoodRecipeIds = new(); [ReadOnly, ShowInInspector] private Dictionary _todayDrinkRecipeIds = new(); [ReadOnly, ShowInInspector] private List _todayWorkerIds = new(); - [ReadOnly, ShowInInspector] private List _todayCookwareIds = new(); + [ReadOnly, ShowInInspector] private Dictionary> _cookwareToRecipeIds = new(); public IReadOnlyDictionary TodayFoodRecipeIds => _todayFoodRecipeIds; public IReadOnlyDictionary TodayDrinkRecipeIds => _todayDrinkRecipeIds; public IReadOnlyList TodayWorkerIds => _todayWorkerIds; - public IReadOnlyList TodayCookwareIds => _todayCookwareIds; + public IReadOnlyDictionary> CookwareToRecipeIds => _cookwareToRecipeIds; public override Task OnReadyNewFlow(GameFlowState newFlowState) { - _todayFoodRecipeIds.Clear(); - _todayDrinkRecipeIds.Clear(); - _todayWorkerIds.Clear(); - _todayCookwareIds.Clear(); + if (newFlowState == GameFlowState.ReadyForRestaurant) + { + InitializeReadyForRestaurant(); + } return Task.CompletedTask; } - public bool TryAddTodayMenu(ItemSlotUi itemSlotUi) + private void InitializeReadyForRestaurant() { - string recipeId = itemSlotUi.Model.Id; - - if (itemSlotUi.Model.ItemType != ItemType.Recipe) return false; + _todayFoodRecipeIds.Clear(); + _todayDrinkRecipeIds.Clear(); + _todayWorkerIds.Clear(); + _cookwareToRecipeIds.Clear(); + } - if (!DataManager.Instance.GetDataSo().TryGetDataById(recipeId, out RecipeData recipeData)) return false; + public bool IsOpenable() + { + // TODO : 영업 가능한 상태인지 조건 추가 (최소 요리, 요리도구 배치 등) + bool isExistedCookware = CookwareToRecipeIds.Count > 0; + bool isExistedMatchedMenu = _cookwareToRecipeIds.Values.Any(recipeSet => recipeSet is { Count: > 0 }); + + return isExistedCookware && isExistedMatchedMenu; + } + + public bool TryAddTodayMenu(ItemViewModel model) + { + string recipeId = model.Id; + + if (model.ItemType != ItemType.Recipe) return false; + + if (DataManager.Instance.GetDataSo().TryGetDataById(recipeId, out RecipeData recipeData) == false) return false; bool added = false; @@ -81,18 +96,24 @@ public bool TryAddTodayMenu(ItemSlotUi itemSlotUi) if (added) { + var cookwareKey = GetRequiredCookwareKey(recipeId); + if (string.IsNullOrWhiteSpace(cookwareKey) == false && _cookwareToRecipeIds.TryGetValue(cookwareKey, out var recipeSet)) + { + recipeSet.Add(recipeId); + } + EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent); } return added; } - public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi) + public bool TryRemoveTodayMenu(ItemViewModel model) { - string recipeId = itemSlotUi.Model.Id; + string recipeId = model.Id; var evt = RestaurantEvents.TodayMenuRemovedEvent; - if (!DataManager.Instance.GetDataSo().TryGetDataById(recipeId, out RecipeData recipeData)) return false; + if (DataManager.Instance.GetDataSo().TryGetDataById(recipeId, out RecipeData recipeData) == false) return false; bool removed = false; int refundCount = 0; @@ -102,7 +123,7 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi) if (_todayFoodRecipeIds.TryGetValue(recipeId, out refundCount)) { removed = _todayFoodRecipeIds.Remove(recipeId); - evt.RecipeType = RecipeType.FoodRecipe; + evt.InventoryCategoryType = InventoryCategoryType.Food; if (removed) { @@ -116,7 +137,7 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi) if (_todayDrinkRecipeIds.TryGetValue(recipeId, out refundCount)) { removed = _todayDrinkRecipeIds.Remove(recipeId); - evt.RecipeType = RecipeType.DrinkRecipe; + evt.InventoryCategoryType = InventoryCategoryType.Drink; if (removed) { @@ -126,39 +147,78 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi) } } - if (!removed) return false; + if (removed) + { + var cookwareKey = GetRequiredCookwareKey(recipeId); + if (string.IsNullOrWhiteSpace(cookwareKey) == false && _cookwareToRecipeIds.TryGetValue(cookwareKey, out var recipeSet)) + { + recipeSet.Remove(recipeId); + } - EventBus.Broadcast(evt); - return true; + EventBus.Broadcast(evt); + } + + return removed; } - public bool TryAddTodayCookware(ItemSlotUi itemSlotUi) + public bool TryAddTodayCookware(ItemViewModel model) { - var itemId = itemSlotUi.Model.Id; + var cookwareId = model.Id; - if (itemSlotUi.Model.Count <= 0 || DataManager.Instance.GetDataSo().TryGetDataById(itemId, out CookwareData cookwareData) == false) return false; + if (model.HasItem == false || DataManager.Instance.GetDataSo().ContainsData(cookwareId) == false) return false; - if (_todayCookwareIds.Count >= MaxCookwareCount || _todayCookwareIds.Contains(itemId)) return false; - - _todayCookwareIds.Add(itemId); + if (_cookwareToRecipeIds.Count >= MaxCookwareCount || _cookwareToRecipeIds.ContainsKey(cookwareId)) return false; + + _cookwareToRecipeIds[cookwareId] = new HashSet(); + + foreach (var recipeId in _todayFoodRecipeIds.Keys.Concat(_todayDrinkRecipeIds.Keys)) + { + var required = GetRequiredCookwareKey(recipeId); + if (required == cookwareId) + { + _cookwareToRecipeIds[cookwareId].Add(recipeId); + } + } + EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent); return true; } + + public bool IsContainTodayMenu(string recipeId)=> _todayFoodRecipeIds.ContainsKey(recipeId) || _todayDrinkRecipeIds.ContainsKey(recipeId); - public bool TryRemoveTodayCookware(ItemSlotUi itemSlotUi) + public bool TryRemoveTodayCookware(ItemViewModel model) { - var itemId = itemSlotUi.Model.Id; + var cookwareId = model.Id; - if (DataManager.Instance.GetDataSo().TryGetDataById(itemId, out CookwareData cookwareData) == false) return false; + if (DataManager.Instance.GetDataSo().ContainsData(cookwareId) == false) return false; - if (_todayCookwareIds.Remove(itemId) == false) return false; + if (_cookwareToRecipeIds.Remove(cookwareId) == false) return false; - EventBus.Broadcast( RestaurantEvents.TodayMenuRemovedEvent); + var evt = RestaurantEvents.TodayMenuRemovedEvent; + evt.InventoryCategoryType = InventoryCategoryType.Cookware; + EventBus.Broadcast(evt); return true; } + + private string GetRequiredCookwareKey(string recipeId) + { + if (DataManager.Instance.GetDataSo().TryGetDataById(recipeId, out var recipeData) == false) return null; - public bool IsContainTodayMenu(string recipeId)=> _todayFoodRecipeIds.ContainsKey(recipeId) || _todayDrinkRecipeIds.ContainsKey(recipeId); + var resultKey = recipeData.RecipeResult; + + return recipeData.RecipeType switch + { + RecipeType.FoodRecipe => DataManager.Instance.GetDataSo().GetDataById(resultKey).CookwareKey, + RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo().GetDataById(resultKey).CookwareKey, + _ => null + }; + } + + public bool IsCookwareMatched(string recipeId) + { + return _cookwareToRecipeIds.Values.Any(recipeHashSets => recipeHashSets.Contains(recipeId)); + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs index b9b9cc6ec..17570e58b 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs @@ -7,7 +7,7 @@ public class InventorySlotUiStrategy : IItemSlotUiStrategy { public string AnimatorControllerKey => "InventorySlotUi"; - public void Setup(ItemSlotUi ui, ItemViewModel model) + public Task Setup(ItemSlotUi ui, ItemViewModel model) { if (InventoryManager.Instance.ContainInventoryItem(model.Id)) { @@ -15,7 +15,8 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) ui.ShowCountText(); ui.HideMark(); ui.SetButtonInteractable(true); - return; + + return Task.CompletedTask; } // TODO : 임시 초기화 값 @@ -36,6 +37,8 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) ui.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); + + return Task.CompletedTask; } public async Task GetAnimatorController() diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs index 2e7a0090c..fb715f15e 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs @@ -18,6 +18,8 @@ public class InventoryView : MonoBehaviour, IEventHandler private InventorySortType _currentSortType = InventorySortType.None; private const string ItemSlotUiName = "ItemSlotUi_"; + + public GameObject GetInitialSelected() => _firstSlot; private void OnEnable() { @@ -33,8 +35,6 @@ private void OnDisable() EventBus.Unregister(this); } - public GameObject GetInitialSelected() => _firstSlot; - public async Task Initialize() { _restaurantManagementSo = @@ -92,7 +92,7 @@ private IEnumerable SortSlots(IEnumerable slots) public void UpdateCategoryView(InventoryCategoryType category) { _currenInventoryCategoryType = category; - _firstSlot = null; + GameObject firstValidSlot = null; var filteredSlots = _slotLookup.Values; var sortedSlots = SortSlots(filteredSlots); @@ -114,12 +114,14 @@ public void UpdateCategoryView(InventoryCategoryType category) { slot.transform.SetSiblingIndex(siblingIndex++); - if (_firstSlot == null) + if (firstValidSlot == null) { - _firstSlot = slot.gameObject; + firstValidSlot = slot.gameObject; } } } + + _firstSlot = firstValidSlot; } private bool MatchesCategory(ItemViewModel model, InventoryCategoryType category) diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs index ba3b99566..ac0ed5bf0 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs @@ -6,7 +6,7 @@ namespace DDD public interface IItemSlotUiStrategy { string AnimatorControllerKey { get; } - void Setup(ItemSlotUi ui, ItemViewModel model); + Task Setup(ItemSlotUi ui, ItemViewModel model); Task GetAnimatorController(); } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs index cb28a31fd..07584f8c3 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs @@ -26,7 +26,7 @@ public async Task Initialize(ItemViewModel model, IItemSlotUiStrategy strategy) var controller = await strategy.GetAnimatorController(); _animator.runtimeAnimatorController = controller; - Strategy.Setup(this, model); + _ = Strategy.Setup(this, model); } public void SetIcon(Sprite sprite) => _icon.sprite = sprite; diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs index a57817096..bf850249a 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -172,16 +172,7 @@ private void OnCategoryTabSelected(InventoryCategoryType category) public void Invoke(TodayMenuRemovedEvent evt) { - InventoryCategoryType newInventoryCategoryType = evt.RecipeType switch - { - RecipeType.FoodRecipe => InventoryCategoryType.Food, - RecipeType.DrinkRecipe => InventoryCategoryType.Drink, - _ => InventoryCategoryType.None - }; - - if (newInventoryCategoryType == InventoryCategoryType.None) return; - - _menuCategoryTabs.SelectTab(newInventoryCategoryType); + _menuCategoryTabs.SelectTab(evt.InventoryCategoryType); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs index 7e976f5e7..ce2b6e936 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs @@ -8,7 +8,7 @@ public void OnAdded(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMana if (inventorySlotUiStrategy.CanCrafting(itemSlotUi)) { - restaurantManagementSo.TryAddTodayMenu(itemSlotUi); + restaurantManagementSo.TryAddTodayMenu(itemSlotUi.Model); } else { @@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMa { if (itemSlotUi.Strategy is InventorySlotUiStrategy) return; - restaurantManagementSo.TryRemoveTodayMenu(itemSlotUi); + restaurantManagementSo.TryRemoveTodayMenu(itemSlotUi.Model); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs index b95fb9b9e..ad1d5ee36 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs @@ -6,6 +6,7 @@ namespace DDD public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy { private readonly RecipeType _recipeType; + private RestaurantManagementSo _restaurantManagementSo; public string AnimatorControllerKey => "TodayMenuSlotUi"; @@ -14,8 +15,10 @@ public TodayMenuSlotUiStrategy(RecipeType recipeType) _recipeType = recipeType; } - public void Setup(ItemSlotUi ui, ItemViewModel model) + public async Task Setup(ItemSlotUi ui, ItemViewModel model) { + _restaurantManagementSo = await AssetManager.LoadAsset(DataConstants.RestaurantManagementSo); + if (model == null) { string emptySpriteKey = null; @@ -32,12 +35,22 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) ui.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); + return; } + string markSpriteKey = null; + if (_restaurantManagementSo.IsCookwareMatched(ui.Model.Id)) + { + markSpriteKey = SpriteConstants.CheckYesSpriteKey; + } + else + { + markSpriteKey = SpriteConstants.CheckNoSpriteKey; + } ui.SetIcon(model.ItemSprite); ui.HideCountText(); - ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 + ui.ShowMark(DataManager.Instance.GetSprite(markSpriteKey)); ui.SetButtonInteractable(true); } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs index 6307ef45a..3c912097d 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs @@ -8,7 +8,7 @@ public void OnAdded(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMana if (inventorySlotUiStrategy.CanCrafting(itemSlotUi)) { - restaurantManagementSo.TryAddTodayCookware(itemSlotUi); + restaurantManagementSo.TryAddTodayCookware(itemSlotUi.Model); } else { @@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMa { if (itemSlotUi.Strategy is InventorySlotUiStrategy) return; - restaurantManagementSo.TryRemoveTodayCookware(itemSlotUi); + restaurantManagementSo.TryRemoveTodayCookware(itemSlotUi.Model); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs index 445f90a50..08487cb1f 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs @@ -9,7 +9,7 @@ public class TodayCookwareSlotUiStrategy : IItemSlotUiStrategy public string AnimatorControllerKey => "TodayMenuSlotUi"; - public void Setup(ItemSlotUi ui, ItemViewModel model) + public Task Setup(ItemSlotUi ui, ItemViewModel model) { if (model == null) { @@ -17,13 +17,16 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) ui.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); - return; + + return Task.CompletedTask; } ui.SetIcon(model.ItemSprite); ui.HideCountText(); ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 ui.SetButtonInteractable(true); + + return Task.CompletedTask; } public async Task GetAnimatorController() diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs index 2de616ab6..55c9a59e8 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs @@ -101,7 +101,7 @@ private void UpdateView() } int cookwareIndex = 0; - foreach (var cookwareKey in _restaurantManagementSo.TodayCookwareIds) + foreach (var cookwareKey in _restaurantManagementSo.CookwareToRecipeIds.Keys) { if (cookwareIndex >= _cookwareSlots.Count) break; diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs index 7b40bf9ad..6296f6deb 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs @@ -9,7 +9,7 @@ public class TodayWorkerSlotUiStrategy : IItemSlotUiStrategy public string AnimatorControllerKey => "TodayMenuSlotUi"; - public void Setup(ItemSlotUi ui, ItemViewModel model) + public Task Setup(ItemSlotUi ui, ItemViewModel model) { if (model == null) { @@ -17,13 +17,16 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) ui.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); - return; + + return Task.CompletedTask; } ui.SetIcon(model.ItemSprite); ui.HideCountText(); ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 ui.SetButtonInteractable(true); + + return Task.CompletedTask; } public async Task GetAnimatorController() diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs new file mode 100644 index 000000000..0b7eed70e --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace DDD +{ + public interface IAiMovement + { + Vector3 CurrentPosition { get; } + Vector3 Destination { get; } + float CurrentSpeed { get; } + bool IsMoving { get; } + + void EnableMove(); + void DisableMove(); + void PlayMove(); + void StopMove(); + void SetMoveSpeed(float speed); + + bool TryMoveToPosition(Vector3 position); + bool TryMoveToTarget(Collider targetCollider); + Vector3 GetRandomBetweenTwoPoints(Vector2? normalizedRange = null); + bool TryTeleportToPosition(Vector3 position); + bool HasReachedDestination(); + bool IsPositionMovable(Vector3 endPosition); + bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0); + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs.meta new file mode 100644 index 000000000..b138eabb2 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 466c0e7347f54d359d083fa944e17a1d +timeCreated: 1754473944 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc.meta new file mode 100644 index 000000000..3d4acccb1 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9842fda5de8da1641ae1f8b12b0f030c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer.meta new file mode 100644 index 000000000..a199e1e35 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05e79ebcdc69f7c43adbfbe42ebfbb83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs new file mode 100644 index 000000000..77f409cd6 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace DDD +{ + public class CustomerCharacter : MonoBehaviour + { + + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs.meta new file mode 100644 index 000000000..b7f59fb7f --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b242c4f65b2734841840c89dfab1500b \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs new file mode 100644 index 000000000..1e691ffd3 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs @@ -0,0 +1,146 @@ +using Pathfinding; +using UnityEngine; + +namespace DDD +{ + public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement + { + private IAstarAI _iAstarAi; + + private const int MaxRandomMoveAttempts = 1000; + + public Vector3 CurrentPosition => _iAstarAi.position; + public Vector3 Destination => _iAstarAi.destination; + public float CurrentSpeed => _iAstarAi.velocity.magnitude; + public bool IsMoving => !_iAstarAi.isStopped && _iAstarAi.hasPath; + + protected override void Awake() + { + base.Awake(); + + _iAstarAi = GetComponent(); + Debug.Assert(_iAstarAi != null, "_iAstarAi is null"); + } + + public void EnableMove() + { + _iAstarAi.canMove = true; + } + + public void DisableMove() + { + _iAstarAi.canMove = false; + } + + public void PlayMove() + { + _iAstarAi.isStopped = false; + } + + public void StopMove() + { + _iAstarAi.isStopped = true; + _iAstarAi.SetPath(null); + } + + public void SetMoveSpeed(float speed) + { + _iAstarAi.maxSpeed = speed; + } + + public bool TryMoveToPosition(Vector3 position) + { + if (IsPositionMovable(position) == false) + { + Debug.LogWarning($"{gameObject.name}이 이동 불가능한 위치를 대상으로 이동을 시도함"); + return false; + } + + _iAstarAi.destination = position; + PlayMove(); + return true; + } + + public bool TryMoveToTarget(Collider targetCollider) + { + if (targetCollider == null) + { + Debug.LogWarning($"{gameObject.name}이 이동하려는 타겟을 찾지 못함"); + StopMove(); + return false; + } + + return TryMoveToPosition(targetCollider.transform.position); + } + + public Vector3 GetRandomBetweenTwoPoints(Vector2? normalizedRange = null) + { + var range = normalizedRange ?? new Vector2(0.2f, 0.8f); + var randomFactor = Random.Range(range.x, range.y); + return Vector3.Lerp(_iAstarAi.position, _iAstarAi.destination, randomFactor); + } + + public bool TryTeleportToPosition(Vector3 position) + { + if (IsPositionMovable(position) == false) + { + Debug.LogWarning($"{gameObject.name}오브젝트가 이동 불가능한 위치로 텔레포트 시도됨"); + return false; + } + + _iAstarAi.Teleport(position); + return true; + } + + public bool HasReachedDestination() + { + return _iAstarAi.pathPending == false && _iAstarAi.reachedEndOfPath; + } + + public bool IsPositionMovable(Vector3 endPosition) + { + var nearestNode = AstarPath.active.GetNearest(endPosition).node; + return nearestNode != null && nearestNode.Walkable; + } + + public bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0) + { + if (graphIndex < 0 || graphIndex >= AstarPath.active.graphs.Length) + { + Debug.LogWarning($"{gameObject.name} - 유효하지 않은 그래프 인덱스: {graphIndex}"); + return false; + } + + int attempts = 0; + Vector3 randomPosition; + var isMovable = false; + var graphBounds = AstarPath.active.graphs[graphIndex].bounds; + + do + { + var randomDirection = Random.insideUnitCircle.normalized; + var randomOffset = new Vector3(randomDirection.x, 0, randomDirection.y) * Random.Range(0, range); + + randomPosition = _iAstarAi.position + randomOffset; + if (!graphBounds.Contains(randomPosition)) + { + continue; + } + + isMovable = IsPositionMovable(randomPosition); + + attempts++; + } while (!isMovable && attempts < MaxRandomMoveAttempts); + + if (isMovable == false) + { + Debug.LogWarning($"{gameObject.name}오브젝트의 랜덤 위치 탐색 실패"); + return false; + } + + _iAstarAi.destination = randomPosition; + PlayMove(); + return true; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs.meta new file mode 100644 index 000000000..30ec96dae --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8bb787bf70c7c134d9a6a049beb7f66a \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player.meta new file mode 100644 index 000000000..b6cf0c3d8 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a1d00dbfecd9c94d8eada9e9a0cf77f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerCharacter.cs rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerCharacter.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerCharacter.cs.meta rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs.meta diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerDataSo.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerDataSo.cs similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerDataSo.cs rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerDataSo.cs diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerDataSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerDataSo.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerDataSo.cs.meta rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerDataSo.cs.meta diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerInput.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerInput.cs rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerInput.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerInput.cs.meta rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs.meta diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs new file mode 100644 index 000000000..5b86b5206 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs @@ -0,0 +1,103 @@ +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace DDD +{ + public class RestaurantPlayerInteraction : RestaurantCharacterInteraction + { + private RestaurantPlayerDataSo _restaurantPlayerDataSo; + + protected override void Start() + { + base.Start(); + + _ = Initialize(); + } + + private async Task Initialize() + { + _restaurantPlayerDataSo = await AssetManager.LoadAsset(DataConstants.RestaurantPlayerDataSo); + Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null"); + + _restaurantPlayerDataSo.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact)); + _restaurantPlayerDataSo.InteractAction.performed += OnInteractPerformed; + _restaurantPlayerDataSo.InteractAction.canceled += OnInteractCanceled; + + _interactionRadius = _restaurantPlayerDataSo.InteractionRadius; + _interactionLayerMask = _restaurantPlayerDataSo.InteractionLayerMask; + + EventBus.Register(this); + } + + protected override void OnDestroy() + { + base.OnDestroy(); + + if (_restaurantPlayerDataSo != null) + { + _restaurantPlayerDataSo.InteractAction.performed -= OnInteractPerformed; + _restaurantPlayerDataSo.InteractAction.canceled -= OnInteractCanceled; + } + + EventBus.Unregister(this); + } + + private void OnInteractPerformed(InputAction.CallbackContext context) + { + if (_nearestInteractable == null || !_nearestInteractable.CanInteract()) return; + + float requiredHoldTime = _nearestInteractable.GetRequiredHoldTime(); + + if (requiredHoldTime <= 0f) + { + _nearestInteractable.OnInteracted(this); + } + else + { + _isInteracting = true; + _interactHeldTime = 0f; + _interactingTarget = _nearestInteractable; + } + } + + private void OnInteractCanceled(InputAction.CallbackContext context) + { + OnInteractionHoldProgress(0f); + ResetInteractionState(); + } + + protected override void OnNearestInteractableChanged(IInteractable newTarget) + { + if (newTarget != null && newTarget.CanInteract()) + { + BroadcastShowUi(newTarget, 0f); + } + else + { + EventBus.Broadcast(GameEvents.HideInteractionUiEvent); + } + } + + protected override void OnInteractionHoldProgress(float ratio) + { + if (_interactingTarget != null) + { + BroadcastShowUi(_interactingTarget, ratio); + } + } + + protected override void OnInteractionCompleted() + { + + } + + private void BroadcastShowUi(IInteractable interactable, float ratio) + { + var evt = GameEvents.ShowInteractionUiEvent; + evt.TextKey = interactable.GetInteractionMessageKey(); + evt.HoldProgress = ratio; + EventBus.Broadcast(evt); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs.meta new file mode 100644 index 000000000..1d0deec52 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 81e01dd8c1cc3404d805400eba1bb4ae \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs similarity index 99% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerMovement.cs rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs index 9a3c14013..0ec205d5f 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs @@ -35,8 +35,10 @@ public class RestaurantPlayerMovement : RestaurantCharacterMovement #region Unity Lifecycle - private void Awake() + protected override void Awake() { + base.Awake(); + InitializeComponents(); } diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerMovement.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantPlayerMovement.cs.meta rename to Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs.meta diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs index 585a6316f..f706014b9 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs @@ -1,62 +1,41 @@ -using System.Threading.Tasks; +using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; -using UnityEngine.InputSystem; namespace DDD { public class RestaurantCharacterInteraction : MonoBehaviour, IInteractor, IEventHandler { - private RestaurantPlayerDataSo _restaurantPlayerDataSo; - - [ReadOnly, SerializeField] private Collider[] _nearColliders = new Collider[10]; - private IInteractable _nearestInteractable; - private IInteractable _previousInteractable; - private IInteractable _interactingTarget; - - private float _interactHeldTime; - private bool _isInteracting; - - private void Start() - { - _ = Initialize(); - } + [SerializeField, ReadOnly] protected Collider[] _nearColliders = new Collider[10]; - private void Update() - { - if (!_restaurantPlayerDataSo) return; + protected IInteractable _nearestInteractable; + protected IInteractable _previousInteractable; + protected IInteractable _interactingTarget; + protected float _interactHeldTime; + protected bool _isInteracting; + + protected float _interactionRadius = 1f; + protected LayerMask _interactionLayerMask = (LayerMask)(-1); + private Dictionary _cachedSolvers = new(); + + protected virtual void Start() { } + + protected virtual void Update() + { _nearestInteractable = GetNearestInteractable(); if (_nearestInteractable != _previousInteractable) { _previousInteractable = _nearestInteractable; - - if (_nearestInteractable != null && _nearestInteractable.CanInteract()) - { - BroadcastShowUi(_nearestInteractable, 0f); - } - else - { - EventBus.Broadcast(GameEvents.HideInteractionUiEvent); - } + OnNearestInteractableChanged(_nearestInteractable); } - + if (_isInteracting) { - // 도중에 타겟이 바뀐 경우 초기화 if (_nearestInteractable != _interactingTarget) { - _isInteracting = false; - _interactHeldTime = 0f; - _interactingTarget = null; - - // UI 초기화 - if (_nearestInteractable != null && _nearestInteractable.CanInteract()) - { - BroadcastShowUi(_nearestInteractable, 0f); - } - + ResetInteractionState(); return; } @@ -67,109 +46,73 @@ private void Update() if (_interactHeldTime >= requiredHoldTime) { - ratio = 0f; _isInteracting = false; _interactingTarget.OnInteracted(this); _interactingTarget = null; + OnInteractionCompleted(); } - BroadcastShowUi(_interactingTarget, ratio); + OnInteractionHoldProgress(ratio); } } - private void OnDestroy() - { - EventBus.Unregister(this); + protected virtual void OnDestroy() { } - if (_restaurantPlayerDataSo) - { - _restaurantPlayerDataSo.InteractAction.performed -= OnInteractPerformed; - _restaurantPlayerDataSo.InteractAction.canceled -= OnInteractCanceled; - } - } + protected virtual void OnNearestInteractableChanged(IInteractable newTarget) { } + protected virtual void OnInteractionHoldProgress(float ratio) { } + protected virtual void OnInteractionCompleted() { } - private async Task Initialize() - { - _restaurantPlayerDataSo = await AssetManager.LoadAsset(DataConstants.RestaurantPlayerDataSo); - Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null"); - - _restaurantPlayerDataSo.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact)); - - _restaurantPlayerDataSo.InteractAction.performed += OnInteractPerformed; - _restaurantPlayerDataSo.InteractAction.canceled += OnInteractCanceled; - - EventBus.Register(this); - } - - public void Invoke(RestaurantInteractionEvent evt) - { - // TODO : 이벤트결과를 보고 할 일이 있다면 여기서 뭔가 처리. 기본적으로 이벤트에서 이미 인터페이스로 인터랙션 처리됨 - } - - public GameObject GetInteractorGameObject() - { - return gameObject; - } - - private void OnInteractPerformed(InputAction.CallbackContext context) - { - if (_nearestInteractable == null || _nearestInteractable.CanInteract() == false) return; - - float requiredHoldTime = _nearestInteractable.GetRequiredHoldTime(); - - if (requiredHoldTime <= 0f) - { - _nearestInteractable.OnInteracted(this); - } - else - { - _isInteracting = true; - _interactHeldTime = 0f; - _interactingTarget = _nearestInteractable; - } - } - - private void OnInteractCanceled(InputAction.CallbackContext context) + protected void ResetInteractionState() { _isInteracting = false; - _interactHeldTime = 0f; _interactingTarget = null; - - if (_nearestInteractable != null && _nearestInteractable.CanInteract()) - { - BroadcastShowUi(_nearestInteractable, 0f); - } + _interactHeldTime = 0f; + OnInteractionHoldProgress(0f); } - private IInteractable GetNearestInteractable() + protected IInteractable GetNearestInteractable() { - int nearColliderCount = Physics.OverlapSphereNonAlloc(transform.position, _restaurantPlayerDataSo.InteractionRadius, - _nearColliders, _restaurantPlayerDataSo.InteractionLayerMask, QueryTriggerInteraction.Collide); + int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask); + float closestDistance = float.MaxValue; + IInteractable closest = null; - IInteractable nearestInteractable = null; - float minDistance = float.MaxValue; - - for (int i = 0; i < nearColliderCount; i++) + for (int i = 0; i < colliderCount; i++) { - var interactable = _nearColliders[i].GetComponent(); - if (interactable == null || interactable.CanInteract() == false) continue; - - float sqrMagnitude = (interactable.GetInteractableGameObject().transform.position - transform.position).sqrMagnitude; - if (sqrMagnitude > minDistance) continue; - - nearestInteractable = interactable; - minDistance = sqrMagnitude; + var col = _nearColliders[i]; + if (col.TryGetComponent(out var interactable) == false || interactable.CanInteract() == false) continue; + + var type = interactable.GetInteractionType(); + if (ContainTypeToSolver(type, out var solver) == false || solver.CanExecuteInteraction() == false) continue; + + float distance = Vector3.Distance(transform.position, col.transform.position); + if (distance < closestDistance) + { + closestDistance = distance; + closest = interactable; + } } - - return nearestInteractable; + + return closest; } + + public virtual void Invoke(RestaurantInteractionEvent evt) { } + + public GameObject GetInteractorGameObject() => gameObject; - private void BroadcastShowUi(IInteractable interactable, float ratio) + private bool ContainTypeToSolver(InteractionType type, out IInteractionSolver solver) { - var evt = GameEvents.ShowInteractionUiEvent; - evt.TextKey = interactable.GetInteractionMessageKey(); - evt.HoldProgress = ratio; - EventBus.Broadcast(evt); + if (_cachedSolvers.TryGetValue(type, out solver)) return solver != null; + + solver = null; + + if (!RestaurantInteractionEventSolvers.TypeToSolver.TryGetValue(type, out var solverType)) return false; + + if (!TryGetComponent(solverType, out var component)) return false; + + solver = component as IInteractionSolver; + _cachedSolvers[type] = solver; + + return solver != null; } } -} \ No newline at end of file +} diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterMovement.cs index 3493afb94..19920b0b2 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterMovement.cs @@ -5,7 +5,7 @@ namespace DDD public class RestaurantCharacterMovement : MonoBehaviour { private RestaurantCharacterMovementConstraint _constraint; - private void Awake() + protected virtual void Awake() { _constraint = gameObject.AddComponent(); } diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/CreateRestaurantPlayerSo.cs b/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/CreateRestaurantPlayerSo.cs rename to Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/CreateRestaurantPlayerSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/RestaurantCharacter/CreateRestaurantPlayerSo.cs.meta rename to Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs.meta diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantInteractionEvents.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantInteractionEvents.cs index c69a58221..2f86f12c3 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantInteractionEvents.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantInteractionEvents.cs @@ -13,7 +13,8 @@ public static class RestaurantInteractionEventSolvers { public static Dictionary TypeToSolver = new() { - {InteractionType.RestaurantManagementUi, typeof(RestaurantManagementUiEventSolver)} + {InteractionType.RestaurantManagementUi, typeof(RestaurantManagementUiEventSolver)}, + {InteractionType.OpenRestaurant, typeof(RestaurantOpenEventSolver)} }; } diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs index 50f1c83ef..6407cdb0e 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs @@ -6,12 +6,18 @@ public class RestaurantManagementUiEventSolver : MonoBehaviour, IInteractionSolv { public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) { - GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; - if (currentGameFlowState != GameFlowState.ReadyForRestaurant) return false; + if (CanExecuteInteraction() == false) return false; + var evt = GameEvents.OpenPopupUiEvent; evt.UiType = typeof(RestaurantManagementUi); EventBus.Broadcast(evt); return true; } + + public bool CanExecuteInteraction() + { + GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; + return currentGameFlowState == GameFlowState.ReadyForRestaurant; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs new file mode 100644 index 000000000..0ea0c75fa --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using UnityEngine; + +namespace DDD +{ + public class RestaurantOpenEventSolver : MonoBehaviour, IInteractionSolver + { + private RestaurantManagementSo _restaurantManagementSo; + + private void Start() + { + _ = Initialize(); + } + + private async Task Initialize() + { + _restaurantManagementSo = await AssetManager.LoadAsset(DataConstants.RestaurantManagementSo); + } + + public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) + { + if (CanExecuteInteraction() == false) return false; + + GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant); + return true; + } + + public bool CanExecuteInteraction() + { + GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; + return currentGameFlowState == GameFlowState.ReadyForRestaurant && _restaurantManagementSo.IsOpenable(); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs.meta b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs.meta new file mode 100644 index 000000000..26d2cff63 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 713ef022896503d459489d3dfa119f04 +timeCreated: 1753179809