2024-09-30 12:05:19 +00:00
|
|
|
using System;
|
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
using BlueWater.Npcs.Customers;
|
|
|
|
|
|
|
|
namespace BlueWater.BehaviorTrees.Actions
|
|
|
|
{
|
|
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
|
|
[Serializable]
|
|
|
|
public class OrderCocktail : Conditional
|
|
|
|
{
|
|
|
|
private Customer _customer;
|
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
|
|
|
_customer = GetComponent<Customer>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
2024-10-06 23:41:09 +00:00
|
|
|
_customer.OrderCocktail();
|
2024-09-30 12:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
2024-10-06 23:41:09 +00:00
|
|
|
if (_customer.IsWaitTimeOver())
|
2024-09-30 12:05:19 +00:00
|
|
|
{
|
|
|
|
_customer.UnregisterPlayerInteraction();
|
|
|
|
return TaskStatus.Failure;
|
|
|
|
}
|
|
|
|
|
2024-10-06 23:41:09 +00:00
|
|
|
if (!_customer.IsReceivedItem) return TaskStatus.Running;
|
2024-09-30 12:05:19 +00:00
|
|
|
|
2024-10-06 23:41:09 +00:00
|
|
|
_customer.UnregisterPlayerInteraction();
|
|
|
|
|
|
|
|
return _customer.IsOrderedSucceed ? TaskStatus.Success : TaskStatus.Failure;
|
2024-09-30 12:05:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|