From d911c1205d8bf60ae5b328334c82cd9ba8bb72a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 11:35:22 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=ED=83=80=EC=9E=84=20=EB=A6=AC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=A0=9C=EC=9E=91,=20=EA=B7=B8=EC=97=90=20?= =?UTF-8?q?=EB=A7=9E=EB=8A=94=20=EC=98=A4=EB=8D=94=20=EC=84=9C=EB=B8=8C?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AI/Customer/Subtree/CustomerDefault.asset | 4 +- .../AI/Customer/Subtree/OrderSubtree.asset | 4 +- .../AI/Common/Decorator/TimeLimiter.cs | 120 ++++++++++++++++-- 3 files changed, 111 insertions(+), 17 deletions(-) diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset index 82b1dc889..e27c56e57 100644 --- a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cf20b556c79f13fe62788fd710d11e330f8ff35845fdb1205afdbe21bdf3530 -size 65015 +oid sha256:420b17e0ac254aee3beff94245c76fadbdd31a20bce709d76f5b52650747c243 +size 65013 diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset index 6ff001db6..26d33033c 100644 --- a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28c1a3c2113f824ca9b3493aa71a73bffa3040160b830e2fde428b5c7bbe1610 -size 16553 +oid sha256:5193e6649c5835cd58152452f8f166e0e9678c87e98b437b80bdb35c5f173369 +size 20321 diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs index 15c13cd29..4adb569c6 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs @@ -3,6 +3,7 @@ using Opsive.BehaviorDesigner.Runtime.Tasks; using Opsive.BehaviorDesigner.Runtime.Tasks.Decorators; using Opsive.GraphDesigner.Runtime; +using Opsive.GraphDesigner.Runtime.Variables; using Opsive.Shared.Utility; using Unity.Burst; using Unity.Entities; @@ -140,7 +141,9 @@ public struct TimeLimiterComponent : IBufferElementData public TaskStatus TimeoutStatus; } - public struct TimeLimiterTag : IComponentData, IEnableableComponent { } + public struct TimeLimiterTag : IComponentData, IEnableableComponent + { + } [DisableAutoCreation] public partial struct TimeLimiterTaskSystem : ISystem @@ -148,18 +151,19 @@ public partial struct TimeLimiterTaskSystem : ISystem [BurstCompile] private void OnUpdate(ref SystemState state) { - var query = SystemAPI.QueryBuilder().WithAllRW().WithAllRW().WithAllRW().WithAll().Build(); + var query = SystemAPI.QueryBuilder().WithAllRW().WithAllRW() + .WithAllRW().WithAll().Build(); state.Dependency = new TimeLimiterJob() { CurrentTime = (float)SystemAPI.Time.ElapsedTime }.ScheduleParallel(query, state.Dependency); } - + [BurstCompile] private partial struct TimeLimiterJob : IJobEntity { public float CurrentTime; - + [BurstCompile] public void Execute(ref DynamicBuffer branchComponents, ref DynamicBuffer taskComponents, @@ -188,21 +192,24 @@ public void Execute(ref DynamicBuffer branchComponents, branchComponents[taskComponent.BranchIndex] = branchComponent; continue; } + if (taskComponent.Status != TaskStatus.Running) { continue; } - - if (timeLimiterComponent.StartTime >= 0f && - CurrentTime - timeLimiterComponent.StartTime >= timeLimiterComponent.TimeLimit) { + + if (timeLimiterComponent.StartTime >= 0f && + CurrentTime - timeLimiterComponent.StartTime >= timeLimiterComponent.TimeLimit) + { // 시간 초과 taskComponent.Status = timeLimiterComponent.TimeoutStatus; taskComponents[taskComponent.Index] = taskComponent; // 자식 태스크가 실행 중이면 중단 childTaskComponent = taskComponents[taskComponent.Index + 1]; - if (childTaskComponent.Status == TaskStatus.Running || - childTaskComponent.Status == TaskStatus.Queued) { + if (childTaskComponent.Status == TaskStatus.Running || + childTaskComponent.Status == TaskStatus.Queued) + { childTaskComponent.Status = timeLimiterComponent.TimeoutStatus; taskComponents[taskComponent.Index + 1] = childTaskComponent; } @@ -211,14 +218,15 @@ public void Execute(ref DynamicBuffer branchComponents, branchComponents[taskComponent.BranchIndex] = branchComponent; continue; } - + childTaskComponent = taskComponents[taskComponent.Index + 1]; - if (childTaskComponent.Status == TaskStatus.Queued || - childTaskComponent.Status == TaskStatus.Running) { + if (childTaskComponent.Status == TaskStatus.Queued || + childTaskComponent.Status == TaskStatus.Running) + { // The child should keep running. continue; } - + taskComponent.Status = childTaskComponent.Status; taskComponents[taskComponent.Index] = taskComponent; @@ -228,4 +236,90 @@ public void Execute(ref DynamicBuffer branchComponents, } } } + + [NodeDescription("자식 태스크의 실행 시간을 제한합니다 (GameObject 워크플로우)")] + public class SharedTimeLimiter : DecoratorNode + { + [Tooltip("최대 실행 시간(초)")] + [SerializeField] private SharedVariable m_TimeLimit = 30f; + + [Tooltip("시간 초과 시 반환할 상태")] + [SerializeField] private TaskStatus m_TimeoutStatus = TaskStatus.Failure; + + public SharedVariable TimeLimit + { + get => m_TimeLimit; + set => m_TimeLimit = value; + } + + public TaskStatus TimeoutStatus + { + get => m_TimeoutStatus; + set => m_TimeoutStatus = value; + } + + private float m_StartTime; + private float m_PauseTime = -1f; + + public override void OnStart() + { + base.OnStart(); + m_StartTime = Time.time; + } + + public override TaskStatus OnUpdate() + { + var taskComponents = m_BehaviorTree.World.EntityManager.GetBuffer(m_BehaviorTree.Entity); + ref var child = ref taskComponents.ElementAt(Index + 1); + + if (Time.time - m_StartTime >= m_TimeLimit.Value) + { + if (child.Status == TaskStatus.Running || child.Status == TaskStatus.Queued) + { + child.Status = m_TimeoutStatus; + taskComponents[Index + 1] = child; + } + + return m_TimeoutStatus; + } + + if (child.Status == TaskStatus.Success || child.Status == TaskStatus.Failure) + { + return child.Status; + } + + return TaskStatus.Running; + } + + public override void OnBehaviorTreeStopped(bool paused) + { + base.OnBehaviorTreeStopped(paused); + if (paused) m_PauseTime = Time.time; + } + + public override void OnBehaviorTreeStarted() + { + base.OnBehaviorTreeStarted(); + if (m_PauseTime >= 0f) + { + m_StartTime += (Time.time - m_PauseTime); + m_PauseTime = -1f; + } + } + + public override MemberVisibility GetSaveReflectionType(int index) => MemberVisibility.None; + + public override object Save(World world, Entity entity) + { + // [제한 시간, 경과 시간] 저장 + return new object[] { m_TimeLimit.Value, Time.time - m_StartTime }; + } + + public override void Load(object saveData, World world, Entity entity) + { + var data = (object[])saveData; + m_TimeLimit.Value = (float)data[0]; + m_StartTime = Time.time - (float)data[1]; + } + } } \ No newline at end of file From 2fe3bbb9ac468c1cca92ff20e53613e343ff782d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 11:53:33 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=EA=B3=B5=EC=9C=A0=20=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=8A=A4=EC=BD=94=ED=94=84=20=EC=9E=AC=EC=A1=B0=EC=A0=95=20-?= =?UTF-8?q?=20=EC=9D=B4=EC=A0=9C=20=EC=84=9C=EB=B8=8C=ED=8A=B8=EB=A6=AC?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=B5=EC=A0=9C=ED=95=B4=EC=84=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EB=AF=80=EB=A1=9C=20=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=ED=94=84=20=EB=8B=A8=EC=9C=84=EB=A1=9C=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AI/Customer/Subtree/CustomerDefault.asset | 4 +- .../_Addressables/Prefabs/CustomerNpc.prefab | 179 +++++++----------- .../Customer/CustomerBlackboardComponent.cs | 14 +- 3 files changed, 75 insertions(+), 122 deletions(-) diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset index e27c56e57..60c7d1530 100644 --- a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:420b17e0ac254aee3beff94245c76fadbdd31a20bce709d76f5b52650747c243 -size 65013 +oid sha256:61af29ad3709aee08733b30c715f6f318e7f99be67a7a7486eb4cfd72556e972 +size 66395 diff --git a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab index cab81ba4e..bdc58f52b 100644 --- a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab @@ -18,7 +18,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_UniqueID - value: -154127738 + value: -363672009 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_TaskData.Array.size @@ -30,7 +30,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.size - value: 3 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_TaskData.Array.data[0].m_Version @@ -74,8 +74,8 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.data[0].m_ObjectType - value: 'Opsive.GraphDesigner.Runtime.Variables.SharedVariable`1[[System.String, - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' + value: 'Opsive.GraphDesigner.Runtime.Variables.SharedVariable`1[[UnityEngine.GameObject, + UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.data[1].m_ObjectType @@ -426,11 +426,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.data[0].m_Values.Array.size - value: 15 + value: 29 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.data[1].m_Values.Array.size - value: 19 + value: 29 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: m_Data.m_SharedVariableData.Array.data[2].m_Values.Array.size @@ -558,75 +558,75 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[2]' - value: 115 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[3]' - value: 116 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[4]' - value: 111 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[5]' - value: 109 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[6]' - value: 101 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[7]' value: 114 objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[3]' + value: 114 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[4]' + value: 101 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[5]' + value: 110 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[6]' + value: 116 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[7]' + value: 73 + objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[8]' - value: 68 + value: 110 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[9]' - value: 97 + value: 116 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[0]' - value: 83 + value: 67 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[1]' - value: 101 + value: 117 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[2]' - value: 108 + value: 114 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[3]' - value: 102 + value: 114 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[4]' - value: 71 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[5]' - value: 97 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[6]' - value: 109 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[7]' value: 101 objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[5]' + value: 110 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[6]' + value: 116 + objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[7]' + value: 73 + objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[8]' - value: 79 + value: 110 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[9]' - value: 98 + value: 116 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[2].m_Values.Array.data[0]' @@ -742,23 +742,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[10]' - value: 116 + value: 101 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[11]' - value: 97 + value: 114 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[12]' - value: 73 + value: 97 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[13]' - value: 100 + value: 99 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[14]' - value: 2 + value: 116 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_Values.Array.data[15]' @@ -818,39 +818,39 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[10]' - value: 106 - objectReference: {fileID: 0} - - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[11]' value: 101 objectReference: {fileID: 0} + - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} + propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[11]' + value: 114 + objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[12]' - value: 99 + value: 97 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[13]' - value: 116 + value: 99 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[14]' - value: 2 + value: 116 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[15]' - value: 255 + value: 105 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[16]' - value: 255 + value: 111 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[17]' - value: 255 + value: 110 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[18]' - value: 255 + value: 84 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_Values.Array.data[19]' @@ -1374,27 +1374,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_ValuePositions.Array.data[1]' - value: 14 + value: 24 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_ValuePositions.Array.data[2]' - value: 14 + value: 24 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_ValuePositions.Array.data[3]' - value: 15 + value: 25 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_ValuePositions.Array.data[1]' - value: 14 + value: 24 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_ValuePositions.Array.data[2]' - value: 14 + value: 24 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_ValuePositions.Array.data[3]' - value: 15 + value: 25 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[2].m_ValuePositions.Array.data[1]' @@ -1422,7 +1422,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[0].m_LongValueHashes.Array.data[3]' - value: 2962117259711222017 + value: 3253260240476711 objectReference: {fileID: 0} - target: {fileID: 3854744934792897056, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} propertyPath: 'm_Data.m_SharedVariableData.Array.data[1].m_LongValueHashes.Array.data[0]' @@ -1782,9 +1782,6 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} insertIndex: -1 addedObject: {fileID: 3825874317044733320} - - targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - insertIndex: -1 - addedObject: {fileID: -2762894235068769830} m_SourcePrefab: {fileID: 100100000, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} --- !u!1 &4266090516809920735 stripped GameObject: @@ -1827,41 +1824,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: af69e82818254bfa9cabb2dbf9430850, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &-2762894235068769830 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4266090516809920735} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0b02b4aaf7aa44843b836f6e31da7d39, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SharedVariableData: - - m_ObjectType: 'Opsive.GraphDesigner.Runtime.Variables.SharedVariable`1[[System.String, - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' - m_ValueHashes: - m_LongValueHashes: 0d00eb254f8d1b29baa620a07799d549a996976a4a64278901112428f48d1b29 - m_ValuePositions: 000000000e0000000e0000000f000000 - m_Values: 437573746f6d657244617461496403 - m_UnityObjects: [] - m_Version: 3.4 - - m_ObjectType: 'Opsive.GraphDesigner.Runtime.Variables.SharedVariable`1[[UnityEngine.GameObject, - UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' - m_ValueHashes: - m_LongValueHashes: 0d00eb254f8d1b29baa620a07799d549a996976a4a64278927dafeacd28e0b00 - m_ValuePositions: 000000000e0000000e0000000f000000 - m_Values: 53656c6647616d654f626a65637403ffffffff - m_UnityObjects: [] - m_Version: 3.4 - - m_ObjectType: 'Opsive.GraphDesigner.Runtime.Variables.SharedVariable`1[[UnityEngine.GameObject, - UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' - m_ValueHashes: - m_LongValueHashes: 0d00eb254f8d1b29baa620a07799d549a996976a4a64278927dafeacd28e0b00 - m_ValuePositions: 00000000180000001800000019000000 - m_Values: 43757272656e74496e746572616374696f6e54617267657403ffffffff - m_UnityObjects: [] - m_Version: 3.4 - m_UniqueID: -846296488 diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs index ac9b3b539..af5437e41 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs @@ -7,36 +7,30 @@ namespace DDD public class CustomerBlackboardComponent : MonoBehaviour, ICustomerBlackboard, IAISharedBlackboard { private BehaviorTree _behaviorTree; - //private GameObjectSharedVariables _sharedVariables; public void InitializeWithBehaviorTree(BehaviorTree inBehaviorTree) { - //_sharedVariables = GetComponent(); _behaviorTree = inBehaviorTree; if (!_behaviorTree) return; - //_sharedVariables.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); - _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject, SharedVariable.SharingScope.GameObject); + _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); } public void SetCustomerData(string inCustomerDataId) { if (!_behaviorTree) return; - //_sharedVariables.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); - _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerDataId), inCustomerDataId, SharedVariable.SharingScope.GameObject); + _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerDataId), inCustomerDataId); } public void SetBlackboardGameObject(string key, GameObject inGameObject) { if (!_behaviorTree) return; - //_sharedVariables.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); - _behaviorTree.SetVariableValue(key, inGameObject, SharedVariable.SharingScope.GameObject); + _behaviorTree.SetVariableValue(key, inGameObject); } public GameObject GetBlackboardGameObject(string key) { if (!_behaviorTree) return null; - //return _sharedVariables.GetVariable(key).Value; - return _behaviorTree.GetVariable(key, SharedVariable.SharingScope.GameObject)?.Value; + return _behaviorTree.GetVariable(key)?.Value; } } } \ No newline at end of file From bdd6eb45de5c43f1995e826c260c7da92d2d59de Mon Sep 17 00:00:00 2001 From: Jeonghyeon Ha Date: Fri, 29 Aug 2025 12:17:30 +0900 Subject: [PATCH 3/7] =?UTF-8?q?git=20diff=20=EC=96=B4=ED=8A=B8=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitattributes b/.gitattributes index 7f9492298..9ee6a94f2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,20 +10,20 @@ *.uss text # --- Unity YAML 형식 에셋 (텍스트 기반) --- # 병합 품질 향상을 위해 Unity Smart Merge 드라이버 사용 -*.meta text merge=unityyamlmerge eol=lf -*.unity text merge=unityyamlmerge eol=lf -*.prefab text merge=unityyamlmerge eol=lf -*.asset filter=lfs diff=lfs merge=lfs -text -*.mat text merge=unityyamlmerge eol=lf -*.anim text merge=unityyamlmerge eol=lf -*.controller text merge=unityyamlmerge eol=lf -*.overrideController text merge=unityyamlmerge eol=lf -*.mask text merge=unityyamlmerge eol=lf -*.lighting text merge=unityyamlmerge eol=lf -*.renderTexture text merge=unityyamlmerge eol=lf -*.timeline text merge=unityyamlmerge eol=lf -*.playable text merge=unityyamlmerge eol=lf -*.spriteatlasv2 text merge=unityyamlmerge eol=lf +*.meta text merge=unityyamlmerge eol=lf -diff +*.unity text merge=unityyamlmerge eol=lf -diff +*.prefab text merge=unityyamlmerge eol=lf -diff +*.asset filter=lfs diff=lfs merge=lfs -text -diff +*.mat text merge=unityyamlmerge eol=lf -diff +*.anim text merge=unityyamlmerge eol=lf -diff +*.controller text merge=unityyamlmerge eol=lf -diff +*.overrideController text merge=unityyamlmerge eol=lf -diff +*.mask text merge=unityyamlmerge eol=lf -diff +*.lighting text merge=unityyamlmerge eol=lf -diff +*.renderTexture text merge=unityyamlmerge eol=lf -diff +*.timeline text merge=unityyamlmerge eol=lf -diff +*.playable text merge=unityyamlmerge eol=lf -diff +*.spriteatlasv2 text merge=unityyamlmerge eol=lf -diff # 참고: 각자 로컬 Git에 merge.unityyamlmerge.driver를 등록해야 실제로 동작합니다. # --- Git LFS 관리 대상 바이너리 파일들 --- # 이미지 From 015cadde31248671d829b3b437d932f1050c8f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 13:35:46 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=EC=86=90=EB=8B=98=20=ED=83=80=EC=9E=84=20?= =?UTF-8?q?=EB=A6=AC=EB=AF=B8=ED=84=B0=20=EC=A0=9C=EC=9E=91,=20=EB=B8=94?= =?UTF-8?q?=EB=9E=99=EB=B3=B4=EB=93=9C=20=EA=B8=B0=EB=A1=9D=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80,=20string=20=ED=82=A4=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20IAIBlackboard=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=EB=A5=BC=20=EC=A0=9C=EB=84=A4=EB=A6=AD=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Scripts/AI/Common/IAISharedBlackboard.cs | 6 ++- .../Common/Actions/LookAtInteractionTarget.cs | 2 +- .../Common/Actions/MoveToInteractionTarget.cs | 2 +- .../AI/Common/Decorator/TimeLimiter.cs | 43 +++++++++++-------- .../Customer/Actions/StartRestaurantOrder.cs | 6 +-- .../Actions/WaitForPlayerInteraction.cs | 2 +- .../Customer/CustomerBlackboardComponent.cs | 26 +++++------ .../Character/AI/Customer/Decorator.meta | 3 ++ .../Customer/Decorator/CustomerTimeLimiter.cs | 30 +++++++++++++ .../Decorator/CustomerTimeLimiter.cs.meta | 3 ++ ProjectSettings/EditorBuildSettings.asset | 2 +- 11 files changed, 84 insertions(+), 41 deletions(-) create mode 100644 Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator.meta create mode 100644 Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs create mode 100644 Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs.meta diff --git a/Assets/_DDD/_Scripts/AI/Common/IAISharedBlackboard.cs b/Assets/_DDD/_Scripts/AI/Common/IAISharedBlackboard.cs index 8136be741..b21a58bd7 100644 --- a/Assets/_DDD/_Scripts/AI/Common/IAISharedBlackboard.cs +++ b/Assets/_DDD/_Scripts/AI/Common/IAISharedBlackboard.cs @@ -9,7 +9,9 @@ namespace DDD /// public interface IAISharedBlackboard { - void SetBlackboardGameObject(string key, GameObject inGameObject); - GameObject GetBlackboardGameObject(string key); + + void SetBlackboardValue(string key, T inValue); + + T GetBlackboardValue(string key); } } diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/LookAtInteractionTarget.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/LookAtInteractionTarget.cs index 68058dfd2..4805bfbbe 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/LookAtInteractionTarget.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/LookAtInteractionTarget.cs @@ -37,7 +37,7 @@ public override void OnStart() _isLooking = false; var blackboard = gameObject.GetComponent(); - _cachedTarget = blackboard.GetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); + _cachedTarget = blackboard.GetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); } public override TaskStatus OnUpdate() diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/MoveToInteractionTarget.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/MoveToInteractionTarget.cs index 1c37ad0f0..90f804fed 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/MoveToInteractionTarget.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/MoveToInteractionTarget.cs @@ -41,7 +41,7 @@ public override void OnStart() _isMoving = false; var blackboard = gameObject.GetComponent(); - _target = blackboard.GetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); + _target = blackboard.GetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); } public override TaskStatus OnUpdate() diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs index 4adb569c6..679cb98ec 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs @@ -241,30 +241,35 @@ public void Execute(ref DynamicBuffer branchComponents, public class SharedTimeLimiter : DecoratorNode { [Tooltip("최대 실행 시간(초)")] - [SerializeField] private SharedVariable m_TimeLimit = 30f; + [SerializeField] protected SharedVariable _timeLimit = 30f; [Tooltip("시간 초과 시 반환할 상태")] - [SerializeField] private TaskStatus m_TimeoutStatus = TaskStatus.Failure; + [SerializeField] protected TaskStatus _timeoutStatus = TaskStatus.Failure; + + [Tooltip("하단 블랙보드 키에 현재 시간을 저장할 지")] + [SerializeField] protected bool _isBlackboardWriteEnabled = false; + [SerializeField] protected string _blackboardKey = "CurrentTime"; public SharedVariable TimeLimit { - get => m_TimeLimit; - set => m_TimeLimit = value; + get => _timeLimit; + set => _timeLimit = value; } public TaskStatus TimeoutStatus { - get => m_TimeoutStatus; - set => m_TimeoutStatus = value; + get => _timeoutStatus; + set => _timeoutStatus = value; } - private float m_StartTime; - private float m_PauseTime = -1f; + protected float _startTime; + private float _pauseTime = -1f; public override void OnStart() { base.OnStart(); - m_StartTime = Time.time; + _startTime = Time.time; + } public override TaskStatus OnUpdate() @@ -272,15 +277,15 @@ public override TaskStatus OnUpdate() var taskComponents = m_BehaviorTree.World.EntityManager.GetBuffer(m_BehaviorTree.Entity); ref var child = ref taskComponents.ElementAt(Index + 1); - if (Time.time - m_StartTime >= m_TimeLimit.Value) + if (Time.time - _startTime >= _timeLimit.Value) { if (child.Status == TaskStatus.Running || child.Status == TaskStatus.Queued) { - child.Status = m_TimeoutStatus; + child.Status = _timeoutStatus; taskComponents[Index + 1] = child; } - return m_TimeoutStatus; + return _timeoutStatus; } if (child.Status == TaskStatus.Success || child.Status == TaskStatus.Failure) @@ -294,16 +299,16 @@ public override TaskStatus OnUpdate() public override void OnBehaviorTreeStopped(bool paused) { base.OnBehaviorTreeStopped(paused); - if (paused) m_PauseTime = Time.time; + if (paused) _pauseTime = Time.time; } public override void OnBehaviorTreeStarted() { base.OnBehaviorTreeStarted(); - if (m_PauseTime >= 0f) + if (_pauseTime >= 0f) { - m_StartTime += (Time.time - m_PauseTime); - m_PauseTime = -1f; + _startTime += (Time.time - _pauseTime); + _pauseTime = -1f; } } @@ -312,14 +317,14 @@ public override void OnBehaviorTreeStarted() public override object Save(World world, Entity entity) { // [제한 시간, 경과 시간] 저장 - return new object[] { m_TimeLimit.Value, Time.time - m_StartTime }; + return new object[] { _timeLimit.Value, Time.time - _startTime }; } public override void Load(object saveData, World world, Entity entity) { var data = (object[])saveData; - m_TimeLimit.Value = (float)data[0]; - m_StartTime = Time.time - (float)data[1]; + _timeLimit.Value = (float)data[0]; + _startTime = Time.time - (float)data[1]; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/StartRestaurantOrder.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/StartRestaurantOrder.cs index f294c5c79..ba29130bd 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/StartRestaurantOrder.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/StartRestaurantOrder.cs @@ -23,7 +23,7 @@ public override void OnStart() public override TaskStatus OnUpdate() { var blackboard = gameObject.GetComponent(); - var target = blackboard?.GetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); + var target = blackboard?.GetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); IInteractable currentInteractable = target?.GetComponent(); if (_targetOrderType == RestaurantOrderType.Wait) { @@ -34,7 +34,7 @@ public override TaskStatus OnUpdate() return TaskStatus.Failure; } var customerBlackboard = gameObject.GetComponent(); - customerBlackboard?.SetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), currentInteractable.GetInteractableGameObject()); + customerBlackboard?.SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), currentInteractable.GetInteractableGameObject()); } // Check order type of the current interactable @@ -71,7 +71,7 @@ public override TaskStatus OnUpdate() if (_targetOrderType == RestaurantOrderType.Busy) { var customerBlackboard = gameObject.GetComponent(); - customerBlackboard?.SetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), null); + customerBlackboard?.SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), null); } return TaskStatus.Success; diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs index c661a508d..934bb7159 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs @@ -18,7 +18,7 @@ public override void OnStart() GameObject interactionTarget = null; if (!gameObject.TryGetComponent(out var sharedBlackboard)) return; interactionTarget = - sharedBlackboard.GetBlackboardGameObject( + sharedBlackboard.GetBlackboardValue( nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); if (interactionTarget == null) diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs index af5437e41..ed6398a68 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/CustomerBlackboardComponent.cs @@ -11,26 +11,26 @@ public class CustomerBlackboardComponent : MonoBehaviour, ICustomerBlackboard, I public void InitializeWithBehaviorTree(BehaviorTree inBehaviorTree) { _behaviorTree = inBehaviorTree; - if (!_behaviorTree) return; - _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); + SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); } public void SetCustomerData(string inCustomerDataId) { - if (!_behaviorTree) return; - _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerDataId), inCustomerDataId); - } - - public void SetBlackboardGameObject(string key, GameObject inGameObject) - { - if (!_behaviorTree) return; - _behaviorTree.SetVariableValue(key, inGameObject); + SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CustomerDataId), inCustomerDataId); } - public GameObject GetBlackboardGameObject(string key) + public void SetBlackboardValue(string key, T inValue) { - if (!_behaviorTree) return null; - return _behaviorTree.GetVariable(key)?.Value; + if (!_behaviorTree) return; + _behaviorTree.SetVariableValue(key, inValue); + } + + public T GetBlackboardValue(string key) + { + if (!_behaviorTree) return default; + SharedVariable blackboardValue = _behaviorTree.GetVariable(key); + + return blackboardValue != null ? blackboardValue.Value : default; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator.meta b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator.meta new file mode 100644 index 000000000..31757848f --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dd35b9ad54934727805aa8a9e232cffd +timeCreated: 1756440681 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs new file mode 100644 index 000000000..067f23c2c --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs @@ -0,0 +1,30 @@ +using DDD; +using Opsive.BehaviorDesigner.Runtime.Tasks; +using UnityEngine; + +namespace _DDD.Restaurant +{ + public class CustomerTimeLimiter : SharedTimeLimiter + { + private IAISharedBlackboard _blackboard; + public override void OnStart() + { + base.OnStart(); + if (!_isBlackboardWriteEnabled) return; + if (!gameObject.TryGetComponent(out _blackboard)) + { + Debug.LogError($"[{GetType().Name}] 블랙보드를 찾을 수 없습니다. 게임오브젝트 해시코드: {gameObject.GetHashCode()}"); + } + } + + public override TaskStatus OnUpdate() + { + if (_isBlackboardWriteEnabled && _blackboard != null) + { + _blackboard.SetBlackboardValue(_blackboardKey, Time.time - _startTime); + } + + return base.OnUpdate(); + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs.meta new file mode 100644 index 000000000..9f8884e00 --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 546f038ee64e401fb67a4ba7d8717b7f +timeCreated: 1756440694 \ No newline at end of file diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index ed8485fa0..b1d747c7b 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f86abe14bf9fc4c7c93dfa96efd110ef0f56c3fb96a952c57e06a723fc87c352 +oid sha256:5d69f9ac4352f59df16943fd905dd7351328f295b2a8e4f74e8346f7bd4dc1bc size 1075 From 4bdb2899e08c8b4b7f6bd39c4ee805a128993293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 13:41:27 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=EA=B8=B0=EC=A1=B4=20=ED=83=80=EC=9E=84=20?= =?UTF-8?q?=EB=A6=AC=EB=AF=B8=ED=84=B0=EB=A5=BC=20=EC=86=90=EB=8B=98=20?= =?UTF-8?q?=ED=83=80=EC=9E=84=20=EB=A6=AC=EB=AF=B8=ED=84=B0=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset index 26d33033c..092d9daa8 100644 --- a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5193e6649c5835cd58152452f8f166e0e9678c87e98b437b80bdb35c5f173369 -size 20321 +oid sha256:04700c100aa3a030f7b7bd51ace191695a9b465128f224121b437e8660085071 +size 22117 From 77991d562bb163db94f9f4b4e003be971d46ffe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 13:49:15 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=EC=9E=98=EB=AA=BB=EB=90=9C=20=EB=84=A4?= =?UTF-8?q?=EC=9E=84=EC=8A=A4=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Character/AI/Customer/Decorator/CustomerTimeLimiter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs index 067f23c2c..f3e211edb 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Decorator/CustomerTimeLimiter.cs @@ -1,8 +1,7 @@ -using DDD; using Opsive.BehaviorDesigner.Runtime.Tasks; using UnityEngine; -namespace _DDD.Restaurant +namespace DDD.Restaurant { public class CustomerTimeLimiter : SharedTimeLimiter { From f9bb1fb262185778a60ff472c1d4e687914e6778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 14:19:56 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=EA=B9=A8=EC=A7=84=20=EB=8D=B0=EC=BD=94?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset | 4 ++-- .../Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset index 092d9daa8..3d590a8bc 100644 --- a/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset +++ b/Assets/_DDD/_Addressables/AI/Customer/Subtree/OrderSubtree.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04700c100aa3a030f7b7bd51ace191695a9b465128f224121b437e8660085071 -size 22117 +oid sha256:c056ea00663888d9d498dac759d78c1cd3442253b080a0bfddac6eee22b77924 +size 22107 diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs index 679cb98ec..7f6700017 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Decorator/TimeLimiter.cs @@ -269,7 +269,6 @@ public override void OnStart() { base.OnStart(); _startTime = Time.time; - } public override TaskStatus OnUpdate()