2024-09-30 12:05:19 +00:00
|
|
|
using System;
|
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
using BlueWater.Npcs.Customers;
|
|
|
|
using UnityEngine;
|
|
|
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
|
|
|
|
|
|
|
namespace BlueWater.BehaviorTrees.Actions
|
|
|
|
{
|
|
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
|
|
[Serializable]
|
|
|
|
public class EatCocktail : Action
|
|
|
|
{
|
|
|
|
private Customer _customer;
|
|
|
|
private float _elapsedTime;
|
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
|
|
|
_customer = GetComponent<Customer>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
|
|
|
_elapsedTime = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
2024-10-06 23:41:09 +00:00
|
|
|
if (_elapsedTime <= _customer.CurrentLevelData.EatingTime)
|
2024-09-30 12:05:19 +00:00
|
|
|
{
|
|
|
|
_elapsedTime += Time.deltaTime;
|
|
|
|
return TaskStatus.Running;
|
|
|
|
}
|
|
|
|
|
2024-11-11 02:02:24 +00:00
|
|
|
_customer.FinishFood();
|
2024-09-30 12:05:19 +00:00
|
|
|
return TaskStatus.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|