블랙보드에 사용할 SO 제작, MoveToTarget 대중화

This commit is contained in:
김산 2025-08-29 19:30:16 +09:00
parent 466313acb9
commit ec4f5d58c1
10 changed files with 52 additions and 14 deletions

Binary file not shown.

View File

@ -38,7 +38,7 @@ public override void OnStart()
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
_cachedTarget = blackboard.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
_cachedTarget = blackboard.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject));
}
public override TaskStatus OnUpdate()

View File

@ -8,7 +8,7 @@ namespace DDD.Restaurant
/// <summary>
/// IAiMovement를 이용해 인터랙션 타겟으로 이동하는 액션
/// </summary>
public class MoveToInteractionTarget : Action
public class MoveToTargetPoint : Action
{
[Header("Target Settings")]
[Tooltip("InteractionPoints를 사용해 가장 가까운 지점으로 이동")]
@ -41,7 +41,7 @@ public override void OnStart()
_isMoving = false;
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
_target = blackboard.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
_target = blackboard.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject));
}
public override TaskStatus OnUpdate()

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using Opsive.GraphDesigner.Runtime.Variables;
using UnityEngine;
namespace DDD.Restaurant
{
public class BlackboardSo<T> : ScriptableObject where T : Enum
{
private Dictionary<T, SharedVariable> _variables = new();
public SharedVariable<T1> GetVariable<T1>(T key)
{
if (_variables.TryGetValue(key, out var variable))
{
return variable as SharedVariable<T1>;
}
return null;
}
public void SetVariable<T1>(T key, T1 value)
{
var outVariable = GetVariable<T1>(key);
if (outVariable != null)
{
outVariable.Value = value;
}
else
{
SharedVariable<T1> sharedVariable = new SharedVariable<T1>() { Value = value };
_variables.Add(key, sharedVariable);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 24029c24eac8499bbb9ca02126da8148
timeCreated: 1756462002

View File

@ -23,7 +23,7 @@ public override void OnStart()
public override TaskStatus OnUpdate()
{
var blackboard = gameObject.GetComponent<IAISharedBlackboard>();
var target = blackboard?.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
var target = blackboard?.GetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject));
IInteractable currentInteractable = target?.GetComponent<IInteractable>();
if (_targetOrderType == RestaurantOrderType.Wait)
{
@ -34,7 +34,7 @@ public override TaskStatus OnUpdate()
return TaskStatus.Failure;
}
var customerBlackboard = gameObject.GetComponent<IAISharedBlackboard>();
customerBlackboard?.SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), currentInteractable.GetInteractableGameObject());
customerBlackboard?.SetBlackboardValue(nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject), 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<IAISharedBlackboard>();
customerBlackboard?.SetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), null);
customerBlackboard?.SetBlackboardValue<GameObject>(nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject), null);
}
return TaskStatus.Success;

View File

@ -19,7 +19,7 @@ public override void OnStart()
if (!gameObject.TryGetComponent<IAISharedBlackboard>(out var sharedBlackboard)) return;
interactionTarget =
sharedBlackboard.GetBlackboardValue<GameObject>(
nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
nameof(RestaurantCustomerBlackboardKey.CurrentTargetGameObject));
if (interactionTarget == null)
{

View File

@ -6,9 +6,9 @@ public enum RestaurantCustomerBlackboardKey
{
SelfGameObject,
CustomerDataId,
CurrentInteractionTarget,
CurrentMarkerTarget,
IsSatisfy
CurrentTargetGameObject,
SatisfactionLevel,
OrderCount,
}
public interface ICustomerBlackboard

View File

@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using DDD.Restaurant;
using UnityEngine;
namespace DDD
namespace DDD.Restaurant
{
[Serializable]
public class RestaurantPropLocation