From 466313acb99d57e83c995d6052f544bf697205f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Fri, 29 Aug 2025 18:23:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9(string=20key=EB=A5=BC=20enum=20nameof?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD,=20=ED=87=B4=EC=9E=A5=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=BF=BC=EB=A6=AC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AI/Customer/Subtree/CustomerDefault.asset | 4 ++-- .../Common/Actions/LookAtInteractionTarget.cs | 3 ++- .../Common/Actions/SearchAndRegisterMarker.cs | 12 ++++++----- .../Customer/Actions/SatisfactionEvaluator.cs | 3 ++- .../Interfaces/ICustomerBlackboard.cs | 2 ++ .../RestaurantEnvironmentPointQueryEvent.cs | 20 +++++++++---------- .../Restaurant/Event/RestaurantEventBase.cs | 2 +- .../Restaurant/Event/RestaurantEvents.cs | 1 - 8 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset b/Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset index 60c7d1530..3e1550f51 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:61af29ad3709aee08733b30c715f6f318e7f99be67a7a7486eb4cfd72556e972 -size 66395 +oid sha256:1c251100bc2c608cf33bccb1bded2c1618a1df83680615f821597aaaa63b5fb2 +size 67301 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 cb7b1f014..03480dd1a 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,8 @@ public override void OnStart() _isLooking = false; var blackboard = gameObject.GetComponent(); - _cachedTarget = m_BehaviorTree.GetVariable(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)).Value; + + _cachedTarget = blackboard.GetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); } public override TaskStatus OnUpdate() diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/SearchAndRegisterMarker.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/SearchAndRegisterMarker.cs index 96fcccc6c..7e4190980 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/SearchAndRegisterMarker.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Common/Actions/SearchAndRegisterMarker.cs @@ -7,7 +7,7 @@ namespace DDD.Restaurant public class SearchAndRegisterMarker : Action { [SerializeField] private PointType _pointType; - private string _markerBlackboardKey; + [SerializeField] private RestaurantCustomerBlackboardKey _markerBlackboardKey; private bool _isRegistered; public override void OnStart() @@ -15,13 +15,15 @@ public override void OnStart() var environmentState = RestaurantState.Instance?.EnvironmentState; if (environmentState == null) return; var pointProviders = environmentState.GetPointProviderByType(_pointType); + var blackboard = gameObject.GetComponent(); + if (blackboard == null) return; + foreach (var pointProvider in pointProviders) { if (!pointProvider.IsSupportsType(_pointType)) continue; - _isRegistered = RestaurantEvents.EnvironmentPointQueryEvent.RequestEvent(gameObject, pointProvider.GetGameObject(), _pointType); - // 사실 이런 일은 없어야 함 - if (!_isRegistered) continue; - m_BehaviorTree.SetVariableValue(_markerBlackboardKey, pointProvider.GetGameObject()); + blackboard.SetBlackboardValue(nameof(_markerBlackboardKey), pointProvider.GetGameObject()); + _isRegistered = true; + break; } } diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/SatisfactionEvaluator.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/SatisfactionEvaluator.cs index 8ed3a21e0..483191762 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/SatisfactionEvaluator.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/SatisfactionEvaluator.cs @@ -19,7 +19,8 @@ public class SatisfactionEvaluator : Action public override void OnStart() { var currentSatisfaction = CalculateSatisfaction(); - m_BehaviorTree.SetVariableValue(_satisfactionBlackboardKey, (int)currentSatisfaction); + var blackboard = gameObject.GetComponent(); + blackboard.SetBlackboardValue(_satisfactionBlackboardKey, (int)currentSatisfaction); } //TODO 만족도 계산? diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/Interfaces/ICustomerBlackboard.cs b/Assets/_DDD/_Scripts/Restaurant/Character/Interfaces/ICustomerBlackboard.cs index 8754ec832..bacbb2f99 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/Interfaces/ICustomerBlackboard.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/Interfaces/ICustomerBlackboard.cs @@ -7,6 +7,8 @@ public enum RestaurantCustomerBlackboardKey SelfGameObject, CustomerDataId, CurrentInteractionTarget, + CurrentMarkerTarget, + IsSatisfy } public interface ICustomerBlackboard diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEnvironmentPointQueryEvent.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEnvironmentPointQueryEvent.cs index b68c26f1b..7ef165c00 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEnvironmentPointQueryEvent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEnvironmentPointQueryEvent.cs @@ -2,14 +2,14 @@ namespace DDD.Restaurant { - public class RestaurantEnvironmentPointQueryEvent : RestaurantEventBase - { - protected override bool EventSolve(GameObject causer, GameObject target, PointType eventType, ScriptableObject payload) - { - if (!target.TryGetComponent(out IEnvironmentPointProvider provider)) return false; - if (!provider.IsSupportsType(eventType)) return false; - - return true; - } - } + //public class RestaurantEnvironmentPointQueryEvent : RestaurantEventBase + //{ + // protected override bool EventSolve(GameObject causer, GameObject target, PointType eventType, ScriptableObject payload) + // { + // if (!target.TryGetComponent(out IEnvironmentPointProvider provider)) return false; + // if (!provider.IsSupportsType(eventType)) return false; + // + // return true; + // } + //} } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEventBase.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEventBase.cs index 48636f5b1..f2d7ab857 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEventBase.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEventBase.cs @@ -23,7 +23,7 @@ protected RestaurantEventBase MakeInteractionEvent(GameObject causer, GameObj } public bool RequestEvent(GameObject causer, GameObject target, T eventType, - ScriptableObject payload = null, bool shouldBroadcastAfterSolve = true) + ScriptableObject payload = null) { var evt = MakeInteractionEvent(causer, target, eventType, payload); // Solve event directly. 이벤트 처리는 여기서 하고, 이벤트 호출로는 이런 이벤트가 호출되었고 결과가 어떻다는 거 전파하는 식으로. diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEvents.cs b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEvents.cs index b135bcc60..19d3c4f8c 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEvents.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Event/RestaurantEvents.cs @@ -9,7 +9,6 @@ public static class RestaurantEvents public static TodayMenuRemovedEvent TodayMenuRemovedEvent = new(); public static RestaurantInteractionEvent InteractionEvent = new(); - public static RestaurantEnvironmentPointQueryEvent EnvironmentPointQueryEvent = new(); } #region RestaurantInteractionEvents