Add variables and override SetVariable for CustomerBlackboardSo

This commit is contained in:
Jeonghyeon Ha 2025-09-02 12:16:04 +09:00
parent f57e3851e1
commit 95cfd0eb32
3 changed files with 41 additions and 2 deletions

View File

@ -22,7 +22,7 @@ public SharedVariable<T1> GetVariable<T1>(T key)
return null;
}
public void SetVariable<T1>(T key, T1 value)
public virtual void SetVariable<T1>(T key, T1 value)
{
var outVariable = GetVariable<T1>(key);
if (outVariable != null)

View File

@ -7,6 +7,43 @@ namespace DDD.Restaurant
[Serializable]
public class CustomerBlackboardSo : BlackboardSo<RestaurantCustomerBlackboardKey>
{
public GameObject SelfGameObject;
public string CustomerDataId;
public GameObject CurrentTargetGameObject;
public EmotionType SatisfactionLevel;
public int CumulativeOrderCount;
public float MaxPatienceTime;
public float RemainingPatienceTime;
public override void SetVariable<T1>(RestaurantCustomerBlackboardKey key, T1 value)
{
base.SetVariable(key, value);
switch (key)
{
case RestaurantCustomerBlackboardKey.SelfGameObject:
SelfGameObject = value as GameObject;
break;
case RestaurantCustomerBlackboardKey.CustomerDataId:
CustomerDataId = value as string;
break;
case RestaurantCustomerBlackboardKey.CurrentTargetGameObject:
CurrentTargetGameObject = value as GameObject;
break;
case RestaurantCustomerBlackboardKey.SatisfactionLevel:
SatisfactionLevel = (EmotionType)(object)value;
break;
case RestaurantCustomerBlackboardKey.CumulativeOrderCount:
CumulativeOrderCount = (int)(object)value;
break;
case RestaurantCustomerBlackboardKey.MaxPatienceTime:
MaxPatienceTime = (float)(object)value;
break;
case RestaurantCustomerBlackboardKey.RemainingPatienceTime:
RemainingPatienceTime = (float)(object)value;
break;
default:
throw new ArgumentOutOfRangeException(nameof(key), key, null);
}
}
}
}

View File

@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace DDD