diff --git a/.junie/guidelines.md b/.junie/guidelines.md index 0c46bcbd8..f000d4552 100644 --- a/.junie/guidelines.md +++ b/.junie/guidelines.md @@ -30,6 +30,8 @@ - `async`/`await`는 신중하게 사용하십시오. 대부분의 엔진 API 호출에는 Unity 메인 스레드 동기화가 필요합니다. - 거대한 모놀리식 구조보다 작은, 역할에 집중된 컴포넌트 구성을 선호합니다. 프로젝트의 DDD 경계를 준수하십시오. - null 체크와 가드 절을 추가하고, 개발 빌드에서는 명확한 메시지와 함께 빠르게 실패하도록 하십시오. +- 코드는 간결하게 유지하십시오. +- 예외처리 및 로깅은 반드시 필요한 곳에만 적용하십시오. ## Addressables 및 리소스 - `Addressables.LoadAssetAsync`로 로드하고, 사용 후 핸들을 해제하여 누수를 방지하십시오. diff --git a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset index b806c94fd..763dd132c 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a15437d77269438f686d7b3173546c709877f653d6da247dc1b81770f25560c -size 26726 +oid sha256:2edf247d0786d3e3046564f811e23b761262411cf16d5bc16d1e9d8f40c72019 +size 26892 diff --git a/Assets/Opsive/BehaviorDesigner.meta b/Assets/Opsive/BehaviorDesigner.meta new file mode 100644 index 000000000..86ea47e08 --- /dev/null +++ b/Assets/Opsive/BehaviorDesigner.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 610118169ab644240a59a4518e65f582 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Opsive/BehaviorDesigner/Editor.meta b/Assets/Opsive/BehaviorDesigner/Editor.meta new file mode 100644 index 000000000..bafcf10b4 --- /dev/null +++ b/Assets/Opsive/BehaviorDesigner/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cd5ed79d16c6e4d87bb643565305b83d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset b/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset new file mode 100644 index 000000000..96a5e467c --- /dev/null +++ b/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ac487ea3754d276114541f8f56cc9797faea0d0d9476b5a8fb9458384a60a7e +size 707 diff --git a/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset.meta b/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset.meta new file mode 100644 index 000000000..bce315374 --- /dev/null +++ b/Assets/Opsive/BehaviorDesigner/Editor/BehaviorDesignerSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 93d283fa648ee4e53aee0a7c04ebaa56 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Opsive/ImportStatus.asset b/Assets/Opsive/ImportStatus.asset index f88428ca1..63709cf54 100644 --- a/Assets/Opsive/ImportStatus.asset +++ b/Assets/Opsive/ImportStatus.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46c9ab330620d16b0bffbed007128d7dbe5bd2993753eb219b2e22e81c79105c +oid sha256:1a0f6ba03f13e9aeb0c3587099c48e798f64ef3a6fc6bff19e933e8c22cc0990 size 465 diff --git a/Assets/_DDD/_Addressables/AI.meta b/Assets/_DDD/_Addressables/AI.meta new file mode 100644 index 000000000..b1c642165 --- /dev/null +++ b/Assets/_DDD/_Addressables/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07ee80a9ed00a4e418b7d5e5075667da +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/AI/Customer.meta b/Assets/_DDD/_Addressables/AI/Customer.meta new file mode 100644 index 000000000..135c796e9 --- /dev/null +++ b/Assets/_DDD/_Addressables/AI/Customer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 031547555da064a688454887f8eab0ce +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree.meta b/Assets/_DDD/_Addressables/AI/Customer/Subtree.meta new file mode 100644 index 000000000..cb26b3808 --- /dev/null +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 18b1db2fc46ab4e9fa180d0f3a9443b5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset new file mode 100644 index 000000000..f1f9e1f9b --- /dev/null +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd8483b8226cbda88852b05e1285b9603516dfd5842972a2e379a43cb91b9a96 +size 676 diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset.meta b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset.meta new file mode 100644 index 000000000..7fd4abd09 --- /dev/null +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3cb7910be3ff64fe8ba49368e324cd76 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab index c394ee87d..4ac33db37 100644 --- a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab @@ -8,6 +8,14 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_Subtree + value: + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: m_GraphName + value: CustomerBehavior + objectReference: {fileID: 0} - target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -122,4 +130,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b242c4f65b2734841840c89dfab1500b, type: 3} m_Name: m_EditorClassIdentifier: - _interactionType: 0 diff --git a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab index a83cc9148..d3008f683 100644 --- a/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab @@ -105,6 +105,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} insertIndex: -1 addedObject: {fileID: 8626078465432105892} + - targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} + insertIndex: -1 + addedObject: {fileID: 3854744934792897056} m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3} --- !u!1 &7462519206451630147 stripped GameObject: @@ -214,3 +217,33 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8bb787bf70c7c134d9a6a049beb7f66a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &3854744934792897056 +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: 0cdaa3305fa954c45a80c9662aa6f425, type: 3} + m_Name: + m_EditorClassIdentifier: + m_GraphName: NPC + m_Index: 0 + m_Data: + m_TaskData: [] + m_EventTaskData: [] + m_SharedVariableData: [] + m_DisabledEventNodesData: [] + m_DisabledLogicNodesData: [] + m_UniqueID: -1885404201 + m_LogicNodePropertiesData: [] + m_EventNodePropertiesData: [] + m_GroupPropertiesData: [] + m_StartWhenEnabled: 1 + m_PauseWhenDisabled: 0 + m_UpdateMode: 0 + m_EvaluationType: 0 + m_MaxEvaluationCount: 1 + m_Subtree: {fileID: 0} diff --git a/Assets/_DDD/_Addressables/So/RestaurantData/DataObjects/RestaurantCustomerData.asset b/Assets/_DDD/_Addressables/So/RestaurantData/DataObjects/RestaurantCustomerData.asset index 053325a24..e9f312d24 100644 --- a/Assets/_DDD/_Addressables/So/RestaurantData/DataObjects/RestaurantCustomerData.asset +++ b/Assets/_DDD/_Addressables/So/RestaurantData/DataObjects/RestaurantCustomerData.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:601800b5bf452fefff7efc5b6e270a7f75ca3cd7250fe35997f2a79a285ed774 -size 574 +oid sha256:932e87282f92d67a2dcef29190a068413fcf6e3020c3c8a76654cd68d1e57c8e +size 950 diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs index 13b93cd2a..372a58980 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/Customer/CustomerCharacter.cs @@ -1,4 +1,7 @@ +using System.Threading.Tasks; +using Opsive.BehaviorDesigner.Runtime; using UnityEngine; +using UnityEngine.AddressableAssets; namespace DDD { @@ -6,13 +9,44 @@ public class CustomerCharacter : RestaurantNpcCharacter, ICustomerInitializer { private CustomerData _customerData; - public void Initialize(CustomerData customerData) + public async void Initialize(CustomerData customerData) { _customerData = customerData; - // TODO : 손님 생성 로직 추가 + // 스킨 설정 _spineController.SetSkin(_customerData.SpineSkinKey); - // _behaviorTree.EnableBehavior(); + + // CustomerType에 따른 behavior tree subtree 할당 + await InitializeBehaviorTree(); + } + + private async Task InitializeBehaviorTree() + { + var customerData = RestaurantData.Instance.CustomerData; + + if (customerData?.CustomerBehaviorData?.TryGetValue(_customerData.CustomerType, out var subtreeReference) != true) + { + Debug.LogError($"[CustomerCharacter] No behavior data found for CustomerType: {_customerData.CustomerType}"); + return; + } + + try + { + var subtree = await subtreeReference.LoadAssetAsync().Task; + if (subtree != null) + { + _behaviorTree.Subgraph = subtree; + _behaviorTree.StartBehavior(); + } + else + { + Debug.LogError($"[CustomerCharacter] Failed to load subtree for CustomerType: {_customerData.CustomerType}"); + } + } + catch (System.Exception e) + { + Debug.LogError($"[CustomerCharacter] Error loading subtree for CustomerType {_customerData.CustomerType}: {e.Message}"); + } } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs index e453f8bfb..1df86afe0 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Npc/RestaurantNpcCharacter.cs @@ -1,17 +1,18 @@ +using Opsive.BehaviorDesigner.Runtime; using UnityEngine; namespace DDD { - // [RequireComponent(typeof(BehaviorTree))] + [RequireComponent(typeof(BehaviorTree))] public class RestaurantNpcCharacter : RestaurantCharacter { - // protected BehaviorTree _behaviorTree; + protected BehaviorTree _behaviorTree; protected override void Awake() { base.Awake(); - // _behaviorTree = GetComponent(); + _behaviorTree = GetComponent(); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantCustomerData.cs b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantCustomerData.cs index 4dd0e2bd8..8486667ad 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantCustomerData.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantCustomerData.cs @@ -1,6 +1,6 @@ using UnityEngine; using UnityEngine.AddressableAssets; -using UnityEngine.ResourceManagement.ResourceProviders; +using UnityEngine.Rendering; namespace DDD { @@ -8,7 +8,9 @@ namespace DDD public class RestaurantCustomerData : ScriptableObject { [SerializeField] private AssetReferenceGameObject _customerPrefab; - public AssetReferenceGameObject CustomerPrefab => _customerPrefab; + + [SerializeField] private SerializedDictionary _customerBehaviorData; + public SerializedDictionary CustomerBehaviorData => _customerBehaviorData; } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 50dc53f7f..00967b344 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82ceac1294e7988a71a29a422cfd089e1b636ff0515c22d9b2941c66b9276cda -size 27355 +oid sha256:bf8059637de7386580daf6abbd2459b769f86bab4e3b6037e21b6ccba26709ff +size 27370