From 4f8cdd4c48476168fe97cdfe0ca6552039136fe2 Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Tue, 12 Aug 2025 20:46:30 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=90=EB=8B=98=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Environments/Props/Prop_Open.prefab | 4 + .../Props/Prop_Refrigerator.prefab | 25 +--- .../Environments/Props/Props.mat | 7 +- .../Prefabs/BaseRestaurantCharacter.prefab | 14 ++ .../BaseRestaurantCharacter.prefab.meta | 0 .../Prefabs/RestaurantNpc.prefab | 2 +- .../_Addressables/Scenes/Restaurant.unity | 128 ++++++++-------- .../_DDD/_Addressables/So/GameStateSo.asset | 3 + .../_Addressables/So/GameStateSo.asset.meta | 8 + .../So/RestaurantCustomerStateSo.asset | 3 + .../So/RestaurantCustomerStateSo.asset.meta | 8 + .../Prefabs/GoogleSheetManager.prefab | 33 ----- .../So/GoogleSheetSettingsSo.asset | 2 +- .../_Scripts/GameCharacter/SpineController.cs | 4 +- Assets/_DDD/_Scripts/GameFlow/GameFlowTask.cs | 21 +-- .../_Scripts/GameFlow/IGameFlowHandler.cs | 1 + Assets/_DDD/_Scripts/GameState/GameStateSo.cs | 35 +++++ .../_Scripts/GameState/GameStateSo.cs.meta | 2 + .../AutoCreated/Classes/CustomerPoolData.cs | 1 + .../AutoCreated/Classes/LevelData.cs | 19 ++- .../AutoCreated/Classes}/TasteData.cs | 0 .../AutoCreated/Classes}/TasteData.cs.meta | 0 .../AutoCreated/Classes}/TasteDataSo.cs | 0 .../AutoCreated/Classes}/TasteDataSo.cs.meta | 0 .../AutoCreated/GoogleSheetJson.json | 21 ++- .../AutoCreated/So/CustomerDataSo.asset | 4 +- .../AutoCreated/So/CustomerPoolDataSo.asset | 4 +- .../AutoCreated/So/LevelDataSo.asset | 4 +- .../RestaurantCharacter/ICurrentDirection.cs | 9 ++ .../ICurrentDirection.cs.meta | 3 + .../Npc/Customer/CustomerCharacter.cs | 9 +- .../Npc/RestaurantNpcCharacter.cs | 18 +++ .../Npc/RestaurantNpcCharacter.cs.meta | 2 + .../Npc/RestaurantNpcMovement.cs | 15 +- .../Player/RestaurantPlayerCharacter.cs | 28 ---- .../Player/RestaurantPlayerMovement.cs | 2 +- .../RestaurantCharacter.cs | 6 +- .../RestaurantCharacterInteraction.cs | 2 +- .../RestaurantCharacterVisual.cs | 35 +++++ .../RestaurantCharacterVisual.cs.meta | 2 + .../CreateRestaurantPlayerSo.cs | 9 +- .../RestaurantController.cs | 30 +++- .../CreateEnvironmentSo.cs | 9 +- .../RestaurantOpenEventSolver.cs | 1 + .../RestaurantState/Customer.meta} | 5 +- .../Customer/CustomerFactory.cs | 45 ++++++ .../Customer/CustomerFactory.cs.meta | 2 + .../Customer/RandomSpawnScheduleBuilder.cs | 53 +++++++ .../RandomSpawnScheduleBuilder.cs.meta | 3 + .../Customer/RegularSpawnScheduleBuilder.cs | 38 +++++ .../RegularSpawnScheduleBuilder.cs.meta | 3 + .../Customer/RestaurantCustomerStateSo.cs | 137 ++++++++++++++++++ .../RestaurantCustomerStateSo.cs.meta | 2 + .../Customer/SpawnPointProvider.cs | 16 ++ .../Customer/SpawnPointProvider.cs.meta | 2 + .../RestaurantState/Customer/SpawnSchedule.cs | 44 ++++++ .../Customer/SpawnSchedule.cs.meta | 3 + .../Customer/SpawnScheduleUtils.cs | 71 +++++++++ .../Customer/SpawnScheduleUtils.cs.meta | 3 + .../RestaurantManagementSo.cs | 15 +- .../RestaurantManagementSo.cs.meta | 0 Assets/_DDD/_Scripts/Utilities/Constants.cs | 7 + 62 files changed, 777 insertions(+), 205 deletions(-) rename Assets/_DDD/{_ScriptAssets => _Addressables}/Prefabs/BaseRestaurantCharacter.prefab (95%) rename Assets/_DDD/{_ScriptAssets => _Addressables}/Prefabs/BaseRestaurantCharacter.prefab.meta (100%) create mode 100644 Assets/_DDD/_Addressables/So/GameStateSo.asset create mode 100644 Assets/_DDD/_Addressables/So/GameStateSo.asset.meta create mode 100644 Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset create mode 100644 Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta delete mode 100644 Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab create mode 100644 Assets/_DDD/_Scripts/GameState/GameStateSo.cs create mode 100644 Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta rename Assets/_DDD/_Scripts/{GameData => GenerateGoogleSheet/AutoCreated/Classes}/TasteData.cs (100%) rename Assets/_DDD/_Scripts/{GameData => GenerateGoogleSheet/AutoCreated/Classes}/TasteData.cs.meta (100%) rename Assets/_DDD/_Scripts/{GameData => GenerateGoogleSheet/AutoCreated/Classes}/TasteDataSo.cs (100%) rename Assets/_DDD/_Scripts/{GameData => GenerateGoogleSheet/AutoCreated/Classes}/TasteDataSo.cs.meta (100%) create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs.meta rename Assets/_DDD/{_ScriptAssets/Prefabs/GoogleSheetManager.prefab.meta => _Scripts/RestaurantState/Customer.meta} (57%) create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs.meta create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs create mode 100644 Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs.meta rename Assets/_DDD/_Scripts/{GameState => RestaurantState}/RestaurantManagementSo.cs (95%) rename Assets/_DDD/_Scripts/{GameState => RestaurantState}/RestaurantManagementSo.cs.meta (100%) diff --git a/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab b/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab index 6b20ad462..0eb79e709 100644 --- a/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab +++ b/Assets/_DDD/Restaurant/Environments/Props/Prop_Open.prefab @@ -68,6 +68,10 @@ PrefabInstance: propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: a43de73b23f496546a3ea8ccc5166d97, type: 2} + - target: {fileID: 8516969404588314361, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} + propertyPath: m_IsTrigger + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab b/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab index f2ce04cce..c2d555fa4 100644 --- a/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab +++ b/Assets/_DDD/Restaurant/Environments/Props/Prop_Refrigerator.prefab @@ -358,33 +358,10 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} insertIndex: -1 addedObject: {fileID: 7159781468411195695} - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3} - insertIndex: -1 - addedObject: {fileID: 5123936106469897444} + m_AddedComponents: [] 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/Environments/Props/Props.mat b/Assets/_DDD/_Addressables/Environments/Props/Props.mat index 9f33420d3..c41e0831c 100644 --- a/Assets/_DDD/_Addressables/Environments/Props/Props.mat +++ b/Assets/_DDD/_Addressables/Environments/Props/Props.mat @@ -21,7 +21,7 @@ Material: m_LightmapFlags: 2 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 + m_CustomRenderQueue: 2450 stringTagMap: RenderType: TransparentCutout disabledShaderPasses: @@ -46,6 +46,10 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _OpacityMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - unity_Lightmaps: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -84,6 +88,7 @@ Material: - _Smoothness: 0.5 - _SrcBlend: 1 - _Surface: 0 + - _UseOpacityMask: 0 - _WorkflowMode: 1 - _ZTest: 4 - _ZWrite: 1 diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab b/Assets/_DDD/_Addressables/Prefabs/BaseRestaurantCharacter.prefab similarity index 95% rename from Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab rename to Assets/_DDD/_Addressables/Prefabs/BaseRestaurantCharacter.prefab index 27469bbe8..4eaef80ae 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/BaseRestaurantCharacter.prefab @@ -44,6 +44,7 @@ GameObject: - component: {fileID: 5176902543201676162} - component: {fileID: 732677841941379807} - component: {fileID: 3365694194251356714} + - component: {fileID: 8736963048629680089} - component: {fileID: 127430239903465757} - component: {fileID: 3095965496140440094} - component: {fileID: 7606279200344222219} @@ -131,6 +132,19 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 061fa444069fcd74c884c1b3379c41b8, type: 3} m_Name: m_EditorClassIdentifier: + _interactionType: 0 +--- !u!114 &8736963048629680089 +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: ae2637d1ed321b945af3815436c11226, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &127430239903465757 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab.meta b/Assets/_DDD/_Addressables/Prefabs/BaseRestaurantCharacter.prefab.meta similarity index 100% rename from Assets/_DDD/_ScriptAssets/Prefabs/BaseRestaurantCharacter.prefab.meta rename to Assets/_DDD/_Addressables/Prefabs/BaseRestaurantCharacter.prefab.meta diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab index de87b71ab..0049cbd0e 100644 --- a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab @@ -58,7 +58,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} propertyPath: m_Materials.Array.size - value: 4 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} propertyPath: 'm_Materials.Array.data[0]' diff --git a/Assets/_DDD/_Addressables/Scenes/Restaurant.unity b/Assets/_DDD/_Addressables/Scenes/Restaurant.unity index e6e275586..226fe4bec 100644 --- a/Assets/_DDD/_Addressables/Scenes/Restaurant.unity +++ b/Assets/_DDD/_Addressables/Scenes/Restaurant.unity @@ -18914,75 +18914,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 04cb72fe661fd534b950283199ac4a83, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1001 &1804444097 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6237816563216546680, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: m_Name - value: GoogleSheetManager - objectReference: {fileID: 0} - - target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: _editorName - value: "\uB0A8\uD0DC\uAC74" - objectReference: {fileID: 0} - - target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: _currentVersion - value: "6 - 2025-07-30 16:48:31 by \uB0A8\uD0DC\uAC74" - objectReference: {fileID: 0} - - target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} - propertyPath: _refreshTrigger - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3} --- !u!114 &1804718565 MonoBehaviour: m_ObjectHideFlags: 0 @@ -55712,6 +55643,63 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1001 &4356280133832537112 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3867800819943679185, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_Name + value: SpawnPointProvider + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalPosition.x + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalPosition.z + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3} --- !u!212 &4363348815642044154 SpriteRenderer: m_ObjectHideFlags: 0 @@ -93952,7 +93940,6 @@ SceneRoots: - {fileID: 1949741092} - {fileID: 1041959416} - {fileID: 45031421} - - {fileID: 1804444097} - {fileID: 5280945432206803416} - {fileID: 1625822452} - {fileID: 1932987510} @@ -93961,6 +93948,7 @@ SceneRoots: - {fileID: 7627145480117215977} - {fileID: 756009984} - {fileID: 1428769370} + - {fileID: 4356280133832537112} - {fileID: 1056730803} - {fileID: 1893487243018697667} - {fileID: 2093714585} diff --git a/Assets/_DDD/_Addressables/So/GameStateSo.asset b/Assets/_DDD/_Addressables/So/GameStateSo.asset new file mode 100644 index 000000000..26ffef5b3 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/GameStateSo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9141b1f43166655e46607dc6f63a13c25ab60fa517c58c97d59dd0199031d376 +size 411 diff --git a/Assets/_DDD/_Addressables/So/GameStateSo.asset.meta b/Assets/_DDD/_Addressables/So/GameStateSo.asset.meta new file mode 100644 index 000000000..fbacb442f --- /dev/null +++ b/Assets/_DDD/_Addressables/So/GameStateSo.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 094ff53715c99c54ea7e6702a6933228 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset new file mode 100644 index 000000000..46133547f --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f4e00ac56c631cd92403826618ed6a1f8c7529e37f73bd999106cfaf42a117c +size 478 diff --git a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta new file mode 100644 index 000000000..40f43b10b --- /dev/null +++ b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a8ae0a4b68a9b94889b9889b63ebacd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab b/Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab deleted file mode 100644 index 46b669d28..000000000 --- a/Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab +++ /dev/null @@ -1,33 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &6237816563216546680 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4476251547817182662} - m_Layer: 0 - m_Name: GoogleSheetManager - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4476251547817182662 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6237816563216546680} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset b/Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset index 412113e53..29ac09004 100644 --- a/Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset +++ b/Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eecdd43481ffae5b250904bcc2423ca2cffda58e7ed5db1e1934baa5a1baf707 +oid sha256:5f020f838b9782bf84939795ae29fee8af9d7504a2c94f31cde1435932064d7f size 1292 diff --git a/Assets/_DDD/_Scripts/GameCharacter/SpineController.cs b/Assets/_DDD/_Scripts/GameCharacter/SpineController.cs index ce05df758..3b954ea55 100644 --- a/Assets/_DDD/_Scripts/GameCharacter/SpineController.cs +++ b/Assets/_DDD/_Scripts/GameCharacter/SpineController.cs @@ -78,8 +78,8 @@ private void Awake() #endregion - // Initialize methods - #region Initialize methods + // InitializeRunRestaurant methods + #region InitializeRunRestaurant methods private void InitializeComponents() { diff --git a/Assets/_DDD/_Scripts/GameFlow/GameFlowTask.cs b/Assets/_DDD/_Scripts/GameFlow/GameFlowTask.cs index fbc42f2fa..5cec95e27 100644 --- a/Assets/_DDD/_Scripts/GameFlow/GameFlowTask.cs +++ b/Assets/_DDD/_Scripts/GameFlow/GameFlowTask.cs @@ -1,10 +1,11 @@ -using System.Threading.Tasks; -using UnityEngine; - -namespace DDD -{ - public abstract class GameFlowTask : ScriptableObject - { - public abstract Task OnReadyNewFlow(GameFlowState newFlowState); - } -} \ No newline at end of file +// using System.Threading.Tasks; +// using UnityEngine; +// +// namespace DDD +// { +// public abstract class GameFlowTask : ScriptableObject +// { +// public abstract Task OnReadyNewFlow(GameFlowState newFlowState); +// public abstract Task OnExitCurrentFlow(GameFlowState exitingFlowState); +// } +// } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameFlow/IGameFlowHandler.cs b/Assets/_DDD/_Scripts/GameFlow/IGameFlowHandler.cs index 3089ff6cb..e54285a97 100644 --- a/Assets/_DDD/_Scripts/GameFlow/IGameFlowHandler.cs +++ b/Assets/_DDD/_Scripts/GameFlow/IGameFlowHandler.cs @@ -5,5 +5,6 @@ namespace DDD public interface IGameFlowHandler { public Task OnReadyNewFlow(GameFlowState newFlowState); + public Task OnExitCurrentFlow(GameFlowState exitingFlowState); } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs new file mode 100644 index 000000000..464623e1f --- /dev/null +++ b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; +using UnityEngine; + +namespace DDD +{ + [CreateAssetMenu(fileName = "GameStateSo", menuName = "GameState/GameStateSo")] + public class GameStateSo : ScriptableObject, IGameFlowHandler + { + [SerializeField] private int _level = 1; + + public Task OnReadyNewFlow(GameFlowState newFlowState) + { + if (newFlowState is GameFlowState.None or GameFlowState.ReadyForRestaurant) + { + Initialize(); + } + + return Task.CompletedTask; + } + + public Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + return Task.CompletedTask; + } + + private void Initialize() + { + // TODO : 저장된 데이터 가져오기 or 없으면 데이터 초기화 + + _level = 1; + } + + public int GetCurrentLevel() => _level; + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta new file mode 100644 index 000000000..ee8a46b05 --- /dev/null +++ b/Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9b8aa6c32ff3e8b49bc8365e3a6e2218 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/CustomerPoolData.cs b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/CustomerPoolData.cs index 090f2624f..4ef4e3531 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/CustomerPoolData.cs +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/CustomerPoolData.cs @@ -23,5 +23,6 @@ public class CustomerPoolData : IId public string Customers; [ReadOnly] public List ValidCustomers = new(); + } } diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/LevelData.cs b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/LevelData.cs index a14633fe0..ab2cbf1fa 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/LevelData.cs +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/LevelData.cs @@ -4,6 +4,13 @@ namespace DDD { + public enum SpawnType + { + None = 0, + Random, + Regular + } + [Serializable] public class LevelData : IId { @@ -12,6 +19,10 @@ public class LevelData : IId [field: SerializeField] public string Id { get; set; } + /// 레벨 or 평판 + [Tooltip("레벨 or 평판")] + public int Level; + /// 등장 지역 [Tooltip("등장 지역")] public string Area; @@ -24,14 +35,14 @@ public class LevelData : IId [Tooltip("스페셜 손님 풀")] public string SpecialCustomerPool; + /// 스폰 타입 + [Tooltip("스폰 타입")] + public SpawnType SpawnType; + /// 확정 스페셜 손님 수 [Tooltip("확정 스페셜 손님 수")] public int FixSpecialCustomerCount; - /// 추가 스페셜 손님 확률 - [Tooltip("추가 스페셜 손님 확률")] - public int AddSpecialCustomerCount; - /// 손님 리스폰 시간 [Tooltip("손님 리스폰 시간")] public int CustomerRespawnTime; diff --git a/Assets/_DDD/_Scripts/GameData/TasteData.cs b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteData.cs similarity index 100% rename from Assets/_DDD/_Scripts/GameData/TasteData.cs rename to Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteData.cs diff --git a/Assets/_DDD/_Scripts/GameData/TasteData.cs.meta b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteData.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/GameData/TasteData.cs.meta rename to Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteData.cs.meta diff --git a/Assets/_DDD/_Scripts/GameData/TasteDataSo.cs b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteDataSo.cs similarity index 100% rename from Assets/_DDD/_Scripts/GameData/TasteDataSo.cs rename to Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteDataSo.cs diff --git a/Assets/_DDD/_Scripts/GameData/TasteDataSo.cs.meta b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteDataSo.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/GameData/TasteDataSo.cs.meta rename to Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/Classes/TasteDataSo.cs.meta diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/GoogleSheetJson.json b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/GoogleSheetJson.json index 1ab5b89f9..bd3167f37 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/GoogleSheetJson.json +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/GoogleSheetJson.json @@ -233,11 +233,12 @@ "LevelData": [ { "Id:string": "식별번호", + "Level": "레벨 or 평판", "Area:string": "등장 지역", "CustomerPool:string": "일반 손님 풀", "SpecialCustomerPool:string": "스페셜 손님 풀", + "SpawnType:NativeEnum": "스폰 타입", "FixSpecialCustomerCount": "확정 스페셜 손님 수", - "AddSpecialCustomerCount": "추가 스페셜 손님 확률", "CustomerRespawnTime": "손님 리스폰 시간", "Exp": "손님 1명당 경험치", "OrderTime": "주문 대기 인내심 카운트 시간", @@ -246,11 +247,12 @@ }, { "Id:string": "Level001", + "Level": 1, "Area:string": "Area1", "CustomerPool:string": "customer_pool_001", "SpecialCustomerPool:string": "", + "SpawnType:NativeEnum": "Random", "FixSpecialCustomerCount": 0, - "AddSpecialCustomerCount": 0, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, @@ -259,11 +261,12 @@ }, { "Id:string": "Level002", + "Level": 2, "Area:string": "Area1", "CustomerPool:string": "customer_pool_002", "SpecialCustomerPool:string": "special_customer_pool_001", + "SpawnType:NativeEnum": "Random", "FixSpecialCustomerCount": 1, - "AddSpecialCustomerCount": 10, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, @@ -272,11 +275,12 @@ }, { "Id:string": "Level003", + "Level": 3, "Area:string": "Area1", "CustomerPool:string": "customer_pool_003", "SpecialCustomerPool:string": "special_customer_pool_001", + "SpawnType:NativeEnum": "Regular", "FixSpecialCustomerCount": 2, - "AddSpecialCustomerCount": 30, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, @@ -285,11 +289,12 @@ }, { "Id:string": "Level004", + "Level": 4, "Area:string": "Area2", "CustomerPool:string": "customer_pool_004", "SpecialCustomerPool:string": "special_customer_pool_001", + "SpawnType:NativeEnum": "Regular", "FixSpecialCustomerCount": 3, - "AddSpecialCustomerCount": 50, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, @@ -298,11 +303,12 @@ }, { "Id:string": "Level005", + "Level": 5, "Area:string": "Area2", "CustomerPool:string": "customer_pool_005", "SpecialCustomerPool:string": "special_customer_pool_001", + "SpawnType:NativeEnum": "Regular", "FixSpecialCustomerCount": 3, - "AddSpecialCustomerCount": 50, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, @@ -311,11 +317,12 @@ }, { "Id:string": "Level006", + "Level": 6, "Area:string": "Area2", "CustomerPool:string": "customer_pool_006", "SpecialCustomerPool:string": "special_customer_pool_001", + "SpawnType:NativeEnum": "Random", "FixSpecialCustomerCount": 3, - "AddSpecialCustomerCount": 50, "CustomerRespawnTime": 6, "Exp": 13, "OrderTime": 30, diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset index 6664f7883..18a74e4e4 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:797fc92a090a0e479ca95b3b93b577eb9713775669f42d70401e7341a9944649 -size 813 +oid sha256:19d677d0d6a155058cba8b6ad1454aa43979a8f97508d11ff15db65447c1f5f9 +size 925 diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset index d29dc0463..2a1e06063 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:26c65016d41b83ea53a833aeca4e2721ee8ca66742909343fbd54a669f35adac -size 1155 +oid sha256:744e0087510d2c2d522b5f894d684df478acfae5456ec547157af0c662c018f5 +size 1316 diff --git a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset index 786cc4773..72adb126e 100644 --- a/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset +++ b/Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27a40c9840938a5b14c05fde46c325055665a0b9fb1a8b611e80afdb590e513d -size 2136 +oid sha256:b6dc23881018894fb8991532ef912ca1063940b248e1e525533d1d5bd52fb6d7 +size 2125 diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs new file mode 100644 index 000000000..fafe07a1c --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace DDD +{ + public interface ICurrentDirection + { + Vector3 GetCurrentDirection(); + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs.meta new file mode 100644 index 000000000..0e99fab28 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/ICurrentDirection.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e2dc4bb972964f36bba4e0ccc2adbcf8 +timeCreated: 1754992211 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs index 77f409cd6..549e1cd4c 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs @@ -2,8 +2,15 @@ namespace DDD { - public class CustomerCharacter : MonoBehaviour + public class CustomerCharacter : RestaurantNpcCharacter, ICustomerInitializer { + private CustomerData _customerData; + public void Initialize(string customerDataId, CustomerData customerData) + { + _customerData = customerData; + + // TODO : 손님 생성 로직 추가 + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs new file mode 100644 index 000000000..f84416c76 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs @@ -0,0 +1,18 @@ +using BehaviorDesigner.Runtime; + +namespace DDD +{ + public class RestaurantNpcCharacter : RestaurantCharacter + { + protected BehaviorTree _behaviorTree; + protected SpineController _spineController; + + protected override void Awake() + { + base.Awake(); + + _behaviorTree = GetComponent(); + _spineController = GetComponent(); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs.meta new file mode 100644 index 000000000..781b532d7 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cade447fb525e0c49a3c9baaa4da135f \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs index 1e691ffd3..e718d28b7 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcMovement.cs @@ -3,9 +3,10 @@ namespace DDD { - public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement + public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement, ICurrentDirection { private IAstarAI _iAstarAi; + private Vector3 _lastDirection = Vector3.forward; private const int MaxRandomMoveAttempts = 1000; @@ -142,5 +143,17 @@ public bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0) PlayMove(); return true; } + + public Vector3 GetCurrentDirection() + { + var currentVelocity = _iAstarAi.velocity; + + if (currentVelocity.sqrMagnitude > 0.0001f) + { + _lastDirection = currentVelocity.normalized; + } + + return _lastDirection; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs index 796c1da66..851c03542 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs @@ -4,34 +4,6 @@ namespace DDD { public class RestaurantPlayerCharacter : RestaurantCharacter { - private RestaurantPlayerMovement _movement; - private Transform _rootObject; - private Transform _visualLook; - - private void Awake() - { - _movement = GetComponent(); - - _rootObject = transform.Find(CommonConstants.RootObject); - _visualLook = _rootObject.Find(CommonConstants.VisualLook); - } - - private void Update() - { - FlipVisualLook(); - } - - private void FlipVisualLook() - { - Vector3 localScale = _visualLook.localScale; - localScale.x = _movement.GetCurrentDirection().x switch - { - > 0.01f => -Mathf.Abs(localScale.x), - < -0.01f => Mathf.Abs(localScale.x), - _ => localScale.x - }; - _visualLook.localScale = localScale; - } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs index 0ec205d5f..e97ca81cc 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs @@ -7,7 +7,7 @@ namespace DDD { - public class RestaurantPlayerMovement : RestaurantCharacterMovement + public class RestaurantPlayerMovement : RestaurantCharacterMovement, ICurrentDirection { #region Fields diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs index eacd99880..46ecfa207 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs @@ -6,8 +6,10 @@ namespace DDD public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor { [EnumToggleButtons, SerializeField] protected InteractionType _interactionType; - - private void Start() + + protected virtual void Awake() { } + + protected virtual void Start() { foreach (var typeToSolver in RestaurantInteractionEventSolvers.TypeToSolver) { diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs index f706014b9..30a022f59 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterInteraction.cs @@ -72,7 +72,7 @@ protected void ResetInteractionState() protected IInteractable GetNearestInteractable() { - int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask); + int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask, QueryTriggerInteraction.Collide); float closestDistance = float.MaxValue; IInteractable closest = null; diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs new file mode 100644 index 000000000..13b6bfa02 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs @@ -0,0 +1,35 @@ +using UnityEngine; + +namespace DDD +{ + public class RestaurantCharacterVisual : MonoBehaviour + { + private ICurrentDirection _iCurrentDirection; + + private Transform _rootObject; + + private void Awake() + { + _iCurrentDirection = GetComponent(); + + _rootObject = transform.Find(CommonConstants.RootObject); + } + + private void Update() + { + FlipVisualLook(); + } + + private void FlipVisualLook() + { + Vector3 localScale = _rootObject.localScale; + localScale.x = _iCurrentDirection.GetCurrentDirection().x switch + { + > 0.01f => -Mathf.Abs(localScale.x), + < -0.01f => Mathf.Abs(localScale.x), + _ => localScale.x + }; + _rootObject.localScale = localScale; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs.meta b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs.meta new file mode 100644 index 000000000..8e99450cb --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacterVisual.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ae2637d1ed321b945af3815436c11226 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs b/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs index 49664b737..741b74041 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/CreateRestaurantPlayerSo.cs @@ -4,17 +4,22 @@ namespace DDD { [CreateAssetMenu(fileName = "CreateRestaurantPlayerSo", menuName = "GameFlow/CreateRestaurantPlayerSo")] - public class CreateRestaurantPlayerSo : GameFlowTask + public class CreateRestaurantPlayerSo : ScriptableObject, IGameFlowHandler { [SerializeField] private Vector3 _spawnPosition; - public override async Task OnReadyNewFlow(GameFlowState newFlowState) + public async Task OnReadyNewFlow(GameFlowState newFlowState) { var playerPrefab = await AssetManager.LoadAsset(CommonConstants.RestaurantPlayer); var player = Instantiate(playerPrefab, _spawnPosition, playerPrefab.transform.rotation); player.name = CommonConstants.RestaurantPlayer; CameraManager.Instance.GetCameraGameObject(CameraType.RestaurantBaseCamera).SetFollowAndLookAtTarget(player.transform); } + + public Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + return Task.CompletedTask; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs index 95769734c..1a66843b8 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs @@ -6,6 +6,7 @@ namespace DDD public class RestaurantController : Singleton, IManager, IGameFlowHandler { public RestaurantEnvironmentStateSo RestaurantEnvironmentStateSo { get; private set; } + public RestaurantCustomerStateSo RestaurantCustomerStateSo { get; private set; } private const string CreateRestaurantPlayerSo = "CreateRestaurantPlayerSo"; private const string CreateEnvironmentSo = "CreateEnvironmentSo"; @@ -16,9 +17,9 @@ public void PreInit() RegisterFlowHandler(); } - public Task Init() + public async Task Init() { - return Task.CompletedTask;; + await LoadData(); } public void PostInit() @@ -37,6 +38,11 @@ private void LoadOrCreateRestaurantState() RestaurantEnvironmentStateSo = ScriptableObject.CreateInstance(); } + private async Task LoadData() + { + RestaurantCustomerStateSo = await AssetManager.LoadAsset(DataConstants.RestaurantCustomerStateSo); + } + private void GenerateDummyEnvironmentProps() { // Make dummy placement data @@ -70,6 +76,26 @@ public async Task OnReadyNewFlow(GameFlowState newFlowState) InputManager.Instance.SwitchCurrentActionMap(InputActionMaps.Restaurant); await Task.WhenAll(playerHandle, todayMenuHandle); } + else if (newFlowState == GameFlowState.RunRestaurant) + { + var restaurantCustomerStateHandle = RestaurantCustomerStateSo.OnReadyNewFlow(newFlowState); + + await Task.WhenAll(restaurantCustomerStateHandle); + } + } + + public async Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + if (exitingFlowState == GameFlowState.ReadyForRestaurant) + { + + } + else if (exitingFlowState == GameFlowState.RunRestaurant) + { + var restaurantCustomerStateHandle = RestaurantCustomerStateSo.OnExitCurrentFlow(exitingFlowState); + + await Task.WhenAll(restaurantCustomerStateHandle); + } } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEnvironment/CreateEnvironmentSo.cs b/Assets/_DDD/_Scripts/RestaurantEnvironment/CreateEnvironmentSo.cs index adffd304a..a046d4f92 100644 --- a/Assets/_DDD/_Scripts/RestaurantEnvironment/CreateEnvironmentSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantEnvironment/CreateEnvironmentSo.cs @@ -4,9 +4,9 @@ namespace DDD { [CreateAssetMenu(fileName = "CreateEnvironmentSo", menuName = "GameFlow/CreateEnvironmentSo")] - public class CreateEnvironmentSo : GameFlowTask + public class CreateEnvironmentSo : ScriptableObject, IGameFlowHandler { - public override async Task OnReadyNewFlow(GameFlowState newFlowState) + public async Task OnReadyNewFlow(GameFlowState newFlowState) { var baseRestaurantEnvironmentPrefab = await AssetManager.LoadAsset(CommonConstants.BaseRestaurantEnvironment); @@ -17,5 +17,10 @@ public override async Task OnReadyNewFlow(GameFlowState newFlowState) restaurantEnvironment.Initialize(prop); } } + + public Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + return Task.CompletedTask; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs index 0ea0c75fa..3ee7f40ae 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs @@ -19,6 +19,7 @@ private async Task Initialize() public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) { + print("발생"); if (CanExecuteInteraction() == false) return false; GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant); diff --git a/Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer.meta similarity index 57% rename from Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab.meta rename to Assets/_DDD/_Scripts/RestaurantState/Customer.meta index 57f4fb14e..869aa2dfc 100644 --- a/Assets/_DDD/_ScriptAssets/Prefabs/GoogleSheetManager.prefab.meta +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: 05aeb8078f8dc7c489b71a0ce5bc4fac -PrefabImporter: +guid: e9059e1c629bec940846db50327f1072 +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs new file mode 100644 index 000000000..418dfa049 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs @@ -0,0 +1,45 @@ +using System.Threading.Tasks; +using UnityEngine; + +namespace DDD +{ + public interface ICustomerFactory + { + Task CreateAsync(CustomerSpawnArgs args); + } + + public interface ICustomerInitializer + { + void Initialize(string customerDataId, CustomerData customerData); + } + + public struct CustomerSpawnArgs + { + public string CustomerDataId; + public CustomerData CustomerData; + public Vector3 Position; + public Quaternion Rotation; + public Transform Parent; + } + + public class CustomerFactory : ICustomerFactory + { + private GameObject _customerPrefab; + + public async Task CreateAsync(CustomerSpawnArgs args) + { + if (!_customerPrefab) + { + _customerPrefab = await AssetManager.LoadAsset(DataConstants.CustomerNpcPrefab); + } + + var newCustomer = Object.Instantiate(_customerPrefab, args.Position, args.Rotation, args.Parent); + + if (newCustomer.TryGetComponent(out ICustomerInitializer initializer)) + { + initializer.Initialize(args.CustomerDataId, args.CustomerData); + } + return newCustomer; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs.meta new file mode 100644 index 000000000..f59221a05 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/CustomerFactory.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d15841beb12379f49bbc944529426a18 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs new file mode 100644 index 000000000..77646b3f5 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using static DDD.SpawnScheduleUtils; + +namespace DDD +{ + public class RandomSpawnScheduleBuilder : ISpawnScheduleBuilder + { + public SpawnSchedule Build(SpawnScheduleBuildArgs args) + { + var randomGenerator = new Random(args.Seed); + + int normalQuota = Math.Max(0, args.NormalQuota); + int specialQuota = Math.Max(0, args.SpecialQuota); + if (args.NormalIds == null || args.NormalIds.Count == 0) normalQuota = 0; + if (args.SpecialIds == null || args.SpecialIds.Count == 0) specialQuota = 0; + + int total = normalQuota + specialQuota; + if (total == 0) return new SpawnSchedule(Array.Empty()); + + // 스페셜 위치만 무작위 고정(정확히 specialQuota개) + var specialPositions = new HashSet(); + PickUniqueIndices(total, specialQuota, randomGenerator, specialPositions); + + int normalIndex = 0; + int specialIndex = 0; + var result = new List(total); + + for (int i = 0; i < total; i++) + { + bool isSpecial = specialPositions.Contains(i); + if (isSpecial) + { + var id = NextRoundRobin(args.SpecialIds, ref specialIndex); + if (string.IsNullOrEmpty(id) == false) + { + result.Add(id); + } + } + else + { + var id = NextRoundRobin(args.NormalIds, ref normalIndex); + if (string.IsNullOrEmpty(id) == false) + { + result.Add(id); + } + } + } + + return new SpawnSchedule(result); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs.meta new file mode 100644 index 000000000..9f67144c6 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RandomSpawnScheduleBuilder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 50b8d085ff474935a42522d081d6c9d9 +timeCreated: 1754985083 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs new file mode 100644 index 000000000..9823d668d --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using static DDD.SpawnScheduleUtils; + +namespace DDD +{ + public class RegularSpawnScheduleBuilder : ISpawnScheduleBuilder + { + public SpawnSchedule Build(SpawnScheduleBuildArgs args) + { + int normalQuota = Math.Max(0, args.NormalQuota); + int specialQuota = Math.Max(0, args.SpecialQuota); + if (args.NormalIds == null || args.NormalIds.Count == 0) normalQuota = 0; + if (args.SpecialIds == null || args.SpecialIds.Count == 0) specialQuota = 0; + + var kinds = BuildProportionalKinds(normalQuota, specialQuota); + + int normalIndex = 0, specialIndex = 0; + var result = new List(kinds.Count); + + foreach (var kind in kinds) + { + if (kind == CustomerType.Special) + { + var id = NextRoundRobin(args.SpecialIds, ref specialIndex); + if (!string.IsNullOrEmpty(id)) result.Add(id); + } + else + { + var id = NextRoundRobin(args.NormalIds, ref normalIndex); + if (!string.IsNullOrEmpty(id)) result.Add(id); + } + } + + return new SpawnSchedule(result); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs.meta new file mode 100644 index 000000000..62678c8c8 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RegularSpawnScheduleBuilder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dbde1bb5bc8d4378add6c1e0c793f361 +timeCreated: 1754985186 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs new file mode 100644 index 000000000..5c641f8d1 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Sirenix.OdinInspector; +using UnityEngine; + +namespace DDD +{ + [CreateAssetMenu(fileName = "RestaurantCustomerStateSo", menuName = "RestaurantState/RestaurantCustomerStateSo")] + public class RestaurantCustomerStateSo : ScriptableObject, IGameFlowHandler + { + [Title("스폰 제어")] + [Tooltip("플로우 시작 후 첫 손님이 등장하기까지 대기 시간(초)")] + [SerializeField] private float _firstSpawnDelaySeconds = 5f; + + [SerializeField] private Vector3 _spawnPoint = new(5f, 0f, 4f); + + [Title("디버그")] + [SerializeField] private SpawnSchedule _spawnSchedule; + + private GameStateSo _gameStateSo; + private LevelDataSo _levelDataSo; + private CustomerDataSo _customerDataSo; + private CustomerPoolDataSo _customerPoolDataSo; + + private ICustomerFactory _iCustomerFactory; + + private CancellationTokenSource _spawnLoopCancellationTokenSource; + + public async Task OnReadyNewFlow(GameFlowState newFlowState) + { + if (newFlowState == GameFlowState.RunRestaurant) + { + await InitializeRunRestaurant(); + } + } + + public Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + if (exitingFlowState == GameFlowState.RunRestaurant) + { + _spawnLoopCancellationTokenSource?.Cancel(); + _spawnLoopCancellationTokenSource?.Dispose(); + _spawnLoopCancellationTokenSource = null; + } + + return Task.CompletedTask; + } + + private async Task InitializeRunRestaurant() + { + _gameStateSo = await AssetManager.LoadAsset(DataConstants.GameStateSo); + + Debug.Assert(_gameStateSo != null, "_gameStateSo is null"); + + _iCustomerFactory = new CustomerFactory(); + + var currentGameLevel = _gameStateSo.GetCurrentLevel(); + if (_levelDataSo == null) + { + _levelDataSo = DataManager.Instance.GetDataSo(); + } + if (_customerDataSo == null) + { + _customerDataSo = DataManager.Instance.GetDataSo(); + } + if (_customerPoolDataSo == null) + { + _customerPoolDataSo = DataManager.Instance.GetDataSo(); + } + var currentLevelData = _levelDataSo.GetDataList().FirstOrDefault(data => data.Level == currentGameLevel); + + Debug.Assert(currentLevelData != null, "currentLevelData is null"); + + var normalPool = _customerPoolDataSo.GetDataById(currentLevelData.CustomerPool); + var specialPool = _customerPoolDataSo.GetDataById(currentLevelData.SpecialCustomerPool); + + _spawnLoopCancellationTokenSource?.Cancel(); + _spawnLoopCancellationTokenSource = new CancellationTokenSource(); + _ = RunSpawnLoopAsync(currentLevelData, normalPool, specialPool, _spawnLoopCancellationTokenSource.Token); + } + + private async Task RunSpawnLoopAsync(LevelData levelData, CustomerPoolData normalPool, CustomerPoolData specialPool, CancellationToken token) + { + if (_firstSpawnDelaySeconds > 0) + await Task.Delay(TimeSpan.FromSeconds(_firstSpawnDelaySeconds), token); + + var scheduleBuilder = CreateBuilder(levelData.SpawnType); + int randomSeed = Environment.TickCount; + + SpawnSchedule MakeSchedule() => scheduleBuilder.Build(new SpawnScheduleBuildArgs + { + NormalIds = (IReadOnlyList) (normalPool?.ValidCustomers) ?? Array.Empty(), + SpecialIds = (IReadOnlyList) (specialPool?.ValidCustomers) ?? Array.Empty(), + NormalQuota = Math.Max(0, normalPool?.CustomerLimitCount ?? 0), + SpecialQuota = Math.Max(0, specialPool?.CustomerLimitCount ?? 0), + Seed = ++randomSeed + }); + + _spawnSchedule = MakeSchedule(); + float wait = Mathf.Max(0.1f, levelData.CustomerRespawnTime); + + while (token.IsCancellationRequested == false) + { + if (_spawnSchedule.TryDequeue(out var customerId) == false) break; + + if (_customerDataSo.TryGetDataById(customerId, out var customerData)) + { + var rotation = Quaternion.identity; + + _ = _iCustomerFactory.CreateAsync(new CustomerSpawnArgs + { + CustomerDataId = customerId, + CustomerData = customerData, + Position = _spawnPoint, + Rotation = rotation, + Parent = null + }); + } + + await Task.Delay(TimeSpan.FromSeconds(wait), token); + } + } + + private ISpawnScheduleBuilder CreateBuilder(SpawnType type) + { + return type switch + { + SpawnType.Random => new RandomSpawnScheduleBuilder(), + SpawnType.Regular => new RegularSpawnScheduleBuilder(), + _ => new RandomSpawnScheduleBuilder() + }; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs.meta new file mode 100644 index 000000000..cbadc045a --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/RestaurantCustomerStateSo.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 545b3710d04aa3e48923f79f03b5dfc5 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs new file mode 100644 index 000000000..1557012bb --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace DDD +{ + public interface ISpawnPointProvider + { + Vector3 GetSpawnPoint(); + } + + public class SpawnPointProvider : ISpawnPointProvider + { + private Vector3 _spawnPoint = new(5f, 0f, 4f); + + public Vector3 GetSpawnPoint() => _spawnPoint; + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs.meta new file mode 100644 index 000000000..75f3e1d93 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnPointProvider.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7c8eed1028a2d62478e2be784587e268 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs new file mode 100644 index 000000000..3e698025a --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Sirenix.OdinInspector; + +namespace DDD +{ + [Serializable] + public sealed class SpawnSchedule + { + [ShowInInspector] private readonly Queue _queue; + public int Count => _queue.Count; + + public SpawnSchedule(IEnumerable ids) + { + _queue = new Queue(ids); + } + + public bool TryDequeue(out string id) + { + if (_queue.Count == 0) + { + id = null; + return false; + } + + id = _queue.Dequeue(); + return true; + } + } + + public struct SpawnScheduleBuildArgs + { + public IReadOnlyList NormalIds; // Normal 풀의 ValidCustomers + public IReadOnlyList SpecialIds; // Special 풀의 ValidCustomers (없으면 null 또는 빈 목록) + public int NormalQuota; // 한 번의 스케줄에서 뽑아둘 Normal 개수 + public int SpecialQuota; // 한 번의 스케줄에서 뽑아둘 Special 개수 + public int Seed; // 셔플 시드(재현성 필요 시) + } + + public interface ISpawnScheduleBuilder + { + SpawnSchedule Build(SpawnScheduleBuildArgs args); + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs.meta new file mode 100644 index 000000000..35bda1b71 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnSchedule.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 95cd95783b894ae0a43c3ccf3ddac0ce +timeCreated: 1754985041 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs new file mode 100644 index 000000000..b1237639c --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; + +namespace DDD +{ + internal static class SpawnScheduleUtils + { + public static string NextRoundRobin(IReadOnlyList source, ref int index) + { + if (source == null || source.Count == 0) return null; + + if (index >= source.Count) + { + index = 0; + } + + return source[index++]; + } + + /// + /// 비율 분배 시퀀스(N/S)를 생성합니다. 스페셜 우선이 아니라 '노말 우선'입니다. + /// accumulator += specialQuota; if (accumulator > total) => S, else N. + /// + public static List BuildProportionalKinds(int normalQuota, int specialQuota) + { + int normal = Math.Max(0, normalQuota); + int special = Math.Max(0, specialQuota); + int total = normal + special; + + var kinds = new List(total); + if (total == 0) return kinds; + + int accumulator = 0; + for (int i = 0; i < total; i++) + { + accumulator += special; + if (accumulator >= total) // 스페셜 개수 보장 + { + kinds.Add(CustomerType.Special); + accumulator -= total; + } + else + { + kinds.Add(CustomerType.Normal); + } + } + return kinds; + } + + public static void PickUniqueIndices(int total, int pickCount, Random randomGenerator, HashSet output) + { + output.Clear(); + pickCount = Math.Min(Math.Max(0, pickCount), total); + if (pickCount == 0 || total == 0) return; + + // 0..total-1을 부분 Fisher–Yates + var indices = new int[total]; + for (int i = 0; i < total; i++) + { + indices[i] = i; + } + + for (int i = 0; i < pickCount; i++) + { + int j = randomGenerator.Next(i, total); + (indices[i], indices[j]) = (indices[j], indices[i]); + output.Add(indices[i]); + } + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs.meta new file mode 100644 index 000000000..b9ba844a1 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantState/Customer/SpawnScheduleUtils.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c842c3816a9f401595f053255cfba46f +timeCreated: 1754985116 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs b/Assets/_DDD/_Scripts/RestaurantState/RestaurantManagementSo.cs similarity index 95% rename from Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs rename to Assets/_DDD/_Scripts/RestaurantState/RestaurantManagementSo.cs index 3f40aad3d..8c04a016c 100644 --- a/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/RestaurantManagementSo.cs @@ -7,7 +7,7 @@ namespace DDD { [CreateAssetMenu(fileName = "RestaurantManagementSo", menuName = "GameState/RestaurantManagementSo")] - public class RestaurantManagementSo : GameFlowTask + public class RestaurantManagementSo : ScriptableObject, IGameFlowHandler { // TODO : 체크리스트 기능 @@ -24,6 +24,7 @@ public class RestaurantManagementSo : GameFlowTask public int MaxCookwareCount = 6; [Title("실시간 데이터")] + [ReadOnly, SerializeField] private bool _isOpenable; [ReadOnly, ShowInInspector] private Dictionary _todayFoodRecipeIds = new(); [ReadOnly, ShowInInspector] private Dictionary _todayDrinkRecipeIds = new(); [ReadOnly, ShowInInspector] private List _todayWorkerIds = new(); @@ -34,7 +35,7 @@ public class RestaurantManagementSo : GameFlowTask public IReadOnlyList TodayWorkerIds => _todayWorkerIds; public IReadOnlyDictionary> CookwareToRecipeIds => _cookwareToRecipeIds; - public override Task OnReadyNewFlow(GameFlowState newFlowState) + public Task OnReadyNewFlow(GameFlowState newFlowState) { if (newFlowState == GameFlowState.ReadyForRestaurant) { @@ -44,6 +45,11 @@ public override Task OnReadyNewFlow(GameFlowState newFlowState) return Task.CompletedTask; } + public Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + return Task.CompletedTask; + } + private void InitializeReadyForRestaurant() { _todayFoodRecipeIds.Clear(); @@ -57,8 +63,9 @@ public bool IsOpenable() // TODO : 영업 가능한 상태인지 조건 추가 (최소 요리, 요리도구 배치 등) bool isExistedCookware = CookwareToRecipeIds.Count > 0; bool isExistedMatchedMenu = _cookwareToRecipeIds.Values.Any(recipeSet => recipeSet is { Count: > 0 }); - - return isExistedCookware && isExistedMatchedMenu; + + _isOpenable = isExistedCookware && isExistedMatchedMenu; + return _isOpenable; } public bool TryAddTodayMenu(ItemViewModel model) diff --git a/Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs.meta b/Assets/_DDD/_Scripts/RestaurantState/RestaurantManagementSo.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/GameState/RestaurantManagementSo.cs.meta rename to Assets/_DDD/_Scripts/RestaurantState/RestaurantManagementSo.cs.meta diff --git a/Assets/_DDD/_Scripts/Utilities/Constants.cs b/Assets/_DDD/_Scripts/Utilities/Constants.cs index 55e564616..4fccc742a 100644 --- a/Assets/_DDD/_Scripts/Utilities/Constants.cs +++ b/Assets/_DDD/_Scripts/Utilities/Constants.cs @@ -12,6 +12,7 @@ public static class CommonConstants public static class DataConstants { + public const string GameStateSo = "GameStateSo"; public const string InventoryTestDataSo = "InventoryTestDataSo"; public const string ItemDataSo = "ItemDataSo"; public const string RecipeDataSo = "RecipeDataSo"; @@ -21,12 +22,18 @@ public static class DataConstants public const string CookwareDataSo = "CookwareDataSo"; public const string TasteDataSo = "TasteDataSo"; public const string EnvironmentDataSo = "EnvironmentDataSo"; + public const string LevelDataSo = "LevelDataSo"; + public const string CustomerDataSo = "CustomerDataSo"; + public const string CustomerPoolDataSo = "CustomerPoolDataSo"; public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo"; public const string UiInputBindingSo = "UiInputBindingSo"; public const string RestaurantManagementSo = "RestaurantManagementSo"; + public const string RestaurantCustomerStateSo = "RestaurantCustomerStateSo"; public const string AtlasLabel = "Atlas"; public const string BasePropSpriteMaterial = "BasePropSpriteMaterial"; + + public const string CustomerNpcPrefab = "CustomerNpc"; } public static class RestaurantPlayerAnimation