33 lines
968 B
C#
33 lines
968 B
C#
|
using System;
|
||
|
using BehaviorDesigner.Runtime.Tasks;
|
||
|
using BlueWater.Npcs.Customers;
|
||
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
||
|
|
||
|
namespace BlueWater.BehaviorTrees.Actions
|
||
|
{
|
||
|
[TaskCategory("Custom/Npc/Customer")]
|
||
|
[Serializable]
|
||
|
public class FindTable : Action
|
||
|
{
|
||
|
private Customer _customer;
|
||
|
|
||
|
public override void OnAwake()
|
||
|
{
|
||
|
_customer = GetComponent<Customer>();
|
||
|
}
|
||
|
|
||
|
public override void OnStart()
|
||
|
{
|
||
|
RestaurantManager.Instance.CustomerManager.TryFindEmptySeat(_customer);
|
||
|
}
|
||
|
|
||
|
public override TaskStatus OnUpdate()
|
||
|
{
|
||
|
if (_customer.TableSeat == null) return TaskStatus.Running;
|
||
|
|
||
|
_customer.SetFoodBalloonUi(RestaurantManager.Instance.FoodBalloonUiManager.InstantiateFoodBalloon());
|
||
|
_customer.FoodBalloonUi.Initialize(_customer, _customer.TableSeat);
|
||
|
return TaskStatus.Success;
|
||
|
}
|
||
|
}
|
||
|
}
|