수정 사항 적용(string key를 enum nameof로 변경, 퇴장 이벤트 쿼리 삭제)
This commit is contained in:
parent
bc23cea88a
commit
466313acb9
BIN
Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset
(Stored with Git LFS)
Binary file not shown.
@ -37,7 +37,8 @@ public override void OnStart()
|
|||||||
_isLooking = false;
|
_isLooking = false;
|
||||||
|
|
||||||
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
|
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
|
||||||
_cachedTarget = m_BehaviorTree.GetVariable<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)).Value;
|
|
||||||
|
_cachedTarget = blackboard.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TaskStatus OnUpdate()
|
public override TaskStatus OnUpdate()
|
||||||
|
@ -7,7 +7,7 @@ namespace DDD.Restaurant
|
|||||||
public class SearchAndRegisterMarker : Action
|
public class SearchAndRegisterMarker : Action
|
||||||
{
|
{
|
||||||
[SerializeField] private PointType _pointType;
|
[SerializeField] private PointType _pointType;
|
||||||
private string _markerBlackboardKey;
|
[SerializeField] private RestaurantCustomerBlackboardKey _markerBlackboardKey;
|
||||||
private bool _isRegistered;
|
private bool _isRegistered;
|
||||||
|
|
||||||
public override void OnStart()
|
public override void OnStart()
|
||||||
@ -15,13 +15,15 @@ public override void OnStart()
|
|||||||
var environmentState = RestaurantState.Instance?.EnvironmentState;
|
var environmentState = RestaurantState.Instance?.EnvironmentState;
|
||||||
if (environmentState == null) return;
|
if (environmentState == null) return;
|
||||||
var pointProviders = environmentState.GetPointProviderByType(_pointType);
|
var pointProviders = environmentState.GetPointProviderByType(_pointType);
|
||||||
|
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
|
||||||
|
if (blackboard == null) return;
|
||||||
|
|
||||||
foreach (var pointProvider in pointProviders)
|
foreach (var pointProvider in pointProviders)
|
||||||
{
|
{
|
||||||
if (!pointProvider.IsSupportsType(_pointType)) continue;
|
if (!pointProvider.IsSupportsType(_pointType)) continue;
|
||||||
_isRegistered = RestaurantEvents.EnvironmentPointQueryEvent.RequestEvent(gameObject, pointProvider.GetGameObject(), _pointType);
|
blackboard.SetBlackboardValue(nameof(_markerBlackboardKey), pointProvider.GetGameObject());
|
||||||
// 사실 이런 일은 없어야 함
|
_isRegistered = true;
|
||||||
if (!_isRegistered) continue;
|
break;
|
||||||
m_BehaviorTree.SetVariableValue(_markerBlackboardKey, pointProvider.GetGameObject());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ public class SatisfactionEvaluator : Action
|
|||||||
public override void OnStart()
|
public override void OnStart()
|
||||||
{
|
{
|
||||||
var currentSatisfaction = CalculateSatisfaction();
|
var currentSatisfaction = CalculateSatisfaction();
|
||||||
m_BehaviorTree.SetVariableValue(_satisfactionBlackboardKey, (int)currentSatisfaction);
|
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
|
||||||
|
blackboard.SetBlackboardValue(_satisfactionBlackboardKey, (int)currentSatisfaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO 만족도 계산?
|
//TODO 만족도 계산?
|
||||||
|
@ -7,6 +7,8 @@ public enum RestaurantCustomerBlackboardKey
|
|||||||
SelfGameObject,
|
SelfGameObject,
|
||||||
CustomerDataId,
|
CustomerDataId,
|
||||||
CurrentInteractionTarget,
|
CurrentInteractionTarget,
|
||||||
|
CurrentMarkerTarget,
|
||||||
|
IsSatisfy
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ICustomerBlackboard
|
public interface ICustomerBlackboard
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace DDD.Restaurant
|
namespace DDD.Restaurant
|
||||||
{
|
{
|
||||||
public class RestaurantEnvironmentPointQueryEvent : RestaurantEventBase<PointType>
|
//public class RestaurantEnvironmentPointQueryEvent : RestaurantEventBase<PointType>
|
||||||
{
|
//{
|
||||||
protected override bool EventSolve(GameObject causer, GameObject target, PointType eventType, ScriptableObject payload)
|
// protected override bool EventSolve(GameObject causer, GameObject target, PointType eventType, ScriptableObject payload)
|
||||||
{
|
// {
|
||||||
if (!target.TryGetComponent(out IEnvironmentPointProvider provider)) return false;
|
// if (!target.TryGetComponent(out IEnvironmentPointProvider provider)) return false;
|
||||||
if (!provider.IsSupportsType(eventType)) return false;
|
// if (!provider.IsSupportsType(eventType)) return false;
|
||||||
|
//
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ protected RestaurantEventBase<T> MakeInteractionEvent(GameObject causer, GameObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool RequestEvent(GameObject causer, GameObject target, T eventType,
|
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);
|
var evt = MakeInteractionEvent(causer, target, eventType, payload);
|
||||||
// Solve event directly. 이벤트 처리는 여기서 하고, 이벤트 호출로는 이런 이벤트가 호출되었고 결과가 어떻다는 거 전파하는 식으로.
|
// Solve event directly. 이벤트 처리는 여기서 하고, 이벤트 호출로는 이런 이벤트가 호출되었고 결과가 어떻다는 거 전파하는 식으로.
|
||||||
|
@ -9,7 +9,6 @@ public static class RestaurantEvents
|
|||||||
public static TodayMenuRemovedEvent TodayMenuRemovedEvent = new();
|
public static TodayMenuRemovedEvent TodayMenuRemovedEvent = new();
|
||||||
|
|
||||||
public static RestaurantInteractionEvent InteractionEvent = new();
|
public static RestaurantInteractionEvent InteractionEvent = new();
|
||||||
public static RestaurantEnvironmentPointQueryEvent EnvironmentPointQueryEvent = new();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region RestaurantInteractionEvents
|
#region RestaurantInteractionEvents
|
||||||
|
Loading…
Reference in New Issue
Block a user