2024-11-11 02:02:24 +00:00
|
|
|
using System;
|
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
2025-02-10 02:13:46 +00:00
|
|
|
using DDD.Npcs.Customers;
|
2024-11-11 02:02:24 +00:00
|
|
|
using Action = BehaviorDesigner.Runtime.Tasks.Action;
|
|
|
|
|
2025-02-10 02:13:46 +00:00
|
|
|
namespace DDD.BehaviorTrees.Actions
|
2024-11-11 02:02:24 +00:00
|
|
|
{
|
|
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
|
|
[Serializable]
|
|
|
|
public class PayMoney : Action
|
|
|
|
{
|
|
|
|
private Customer _customer;
|
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
|
|
|
_customer = GetComponent<Customer>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
|
|
|
_customer.MoveMoneyCounter();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
|
|
|
if (!_customer.CanMoneyCounterInteractionPosition()) return TaskStatus.Running;
|
|
|
|
|
|
|
|
_customer.PayMoney();
|
|
|
|
return TaskStatus.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|