38 lines
985 B
C#
38 lines
985 B
C#
using System;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
using DDD.Npcs.Customers;
|
|
|
|
namespace DDD.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()
|
|
{
|
|
_customer.OrderCocktail();
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (_customer.IsWaitTimeOver())
|
|
{
|
|
_customer.UnregisterPlayerInteraction();
|
|
return TaskStatus.Failure;
|
|
}
|
|
|
|
if (!_customer.IsReceivedItem) return TaskStatus.Running;
|
|
|
|
_customer.UnregisterPlayerInteraction();
|
|
|
|
return _customer.IsOrderedCorrected ? TaskStatus.Success : TaskStatus.Failure;
|
|
}
|
|
}
|
|
} |