93 lines
3.5 KiB
C#
93 lines
3.5 KiB
C#
using System;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
using DDD.Items;
|
|
using DDD.Npcs.Customers;
|
|
using DDD.Uis;
|
|
using PixelCrushers.DialogueSystem;
|
|
using UnityEngine;
|
|
|
|
namespace DDD.BehaviorTrees.Actions
|
|
{
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
[Serializable]
|
|
public class OrderBeverage : Conditional
|
|
{
|
|
// private Customer _customer;
|
|
// private CustomerData _customerData;
|
|
// private BalloonUi _balloonUi;
|
|
//
|
|
// public override void OnAwake()
|
|
// {
|
|
// _customer = GetComponent<Customer>();
|
|
// _customerData = _customer.CustomerData;
|
|
// }
|
|
//
|
|
// public override void OnStart()
|
|
// {
|
|
// _balloonUi = _customer.BalloonUi;
|
|
// // TODO : 음료가 다양해질 때 수정해야함
|
|
// _balloonUi.OrderItem("40001", _customerData.WaitTime, _customerData.HurryTime);
|
|
//
|
|
// _customer.OnInteraction += HandleBeverageInteraction;
|
|
// _customer.RegisterPlayerInteraction();
|
|
// _customer.Bark("OrderBeverage", BarkOrder.FirstValid);
|
|
// }
|
|
//
|
|
// public override TaskStatus OnUpdate()
|
|
// {
|
|
// if (_balloonUi.IsFoodReceive())
|
|
// {
|
|
// _customer.OnInteraction -= HandleBeverageInteraction;
|
|
// _customer.UnregisterPlayerInteraction();
|
|
// return TaskStatus.Success;
|
|
// }
|
|
//
|
|
// if (_balloonUi.IsWaitTimeOver())
|
|
// {
|
|
// _customer.OnInteraction -= HandleBeverageInteraction;
|
|
// _customer.UnregisterPlayerInteraction();
|
|
// _customer.AddHappyPoint(-3);
|
|
// if (_customer.HappyPoint <= 0)
|
|
// {
|
|
// _balloonUi.CancelOrder();
|
|
// var barkName = _customer.HappyPoint switch
|
|
// {
|
|
// >= 3 => "SatisfactoryEvaluation",
|
|
// >= 2 => "MediocreEvaluation",
|
|
// >= 1 => "MediocreEvaluation",
|
|
// _ => "UnsatisfactoryEvaluation"
|
|
// };
|
|
// _customer.Bark(barkName, BarkOrder.FirstValid);
|
|
// }
|
|
// return TaskStatus.Failure;
|
|
// }
|
|
//
|
|
// return TaskStatus.Running;
|
|
// }
|
|
//
|
|
// private void HandleBeverageInteraction()
|
|
// {
|
|
// var tycoonPlayer = GameManager.Instance.CurrentTycoonPlayer;
|
|
// var carriedBeverageData = tycoonPlayer.GetCurrentItemData();
|
|
// if (carriedBeverageData == null)
|
|
// {
|
|
// Debug.Log("플레이어가 가지고 있는 음식의 데이터가 없습니다.");
|
|
// return;
|
|
// }
|
|
//
|
|
// // TODO : 음료가 다양해질 때 수정해야함
|
|
// if (carriedBeverageData.Idx == "40001")
|
|
// {
|
|
// tycoonPlayer.GiveItem();
|
|
// _balloonUi.ReceiveFood();
|
|
// var itemData = ItemManager.Instance.ItemDataSo.GetDataByIdx(carriedBeverageData.Idx);
|
|
// _customer.SetFood(itemData);
|
|
// if (itemData.Quality == ItemQuality.High)
|
|
// {
|
|
// _customer.AddHappyPoint(1);
|
|
// }
|
|
// _customer.SpineController.PlayAnimation(CustomerSpineAnimation.Eat.ToString(), true);
|
|
// }
|
|
// }
|
|
}
|
|
} |