using BehaviorDesigner.Runtime.Tasks; using DDD.Npcs.Crews.Server; using DDD.Tycoons; using UnityEngine; namespace DDD.BehaviorTrees.Actions { [TaskCategory("Custom/Npc/Crew/ServerCrew")] public class Refind : Action { private ServerCrew _serverCrew; public override void OnAwake() { _serverCrew = GetComponent(); } public override TaskStatus OnUpdate() { var tycoonManager = TycoonManager.Instance; var orderedCustomer = tycoonManager.CustomerController.FindCustomerMatchingItem(_serverCrew.CurrentPickupItem); if (orderedCustomer) { _serverCrew.OnMission(orderedCustomer, orderedCustomer, ActionType.ServingToCustomer); return TaskStatus.Success; } var emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable(); if (emptyServingTable) { _serverCrew.OnMission(emptyServingTable, null, ActionType.PlaceOnServingTable); return TaskStatus.Success; } return TaskStatus.Running; } } }