CapersProject/Assets/02.Scripts/BlueWater/BehaviorTree/Npc/Customer/Conditional/OrderCocktail.cs

38 lines
997 B
C#
Raw Normal View History

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();
2024-11-15 07:28:13 +00:00
return _customer.IsOrderedCorrected ? TaskStatus.Success : TaskStatus.Failure;
2024-09-30 12:05:19 +00:00
}
}
}