38 lines
922 B
C#
38 lines
922 B
C#
![]() |
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()
|
||
|
{
|
||
|
if (_elapsedTime <= _customer.LevelData.EatingTime)
|
||
|
{
|
||
|
_elapsedTime += Time.deltaTime;
|
||
|
return TaskStatus.Running;
|
||
|
}
|
||
|
|
||
|
_customer.PayMoney();
|
||
|
return TaskStatus.Success;
|
||
|
}
|
||
|
}
|
||
|
}
|