2024-11-11 02:02:24 +00:00
|
|
|
using System;
|
|
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
|
|
using BlueWater.Npcs.Customers;
|
|
|
|
using BlueWater.Tycoons;
|
2024-11-26 08:22:26 +00:00
|
|
|
using BlueWater.Utility;
|
2024-11-11 02:02:24 +00:00
|
|
|
using UnityEngine;
|
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
|
|
namespace BlueWater.BehaviorTrees.Actions
|
|
|
|
{
|
|
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
|
|
[Serializable]
|
|
|
|
public class CanVomit : Conditional
|
|
|
|
{
|
|
|
|
private Customer _customer;
|
|
|
|
private bool _canVomit;
|
|
|
|
private bool _isVomiting;
|
|
|
|
private Vector3 _vomitingPosition;
|
|
|
|
|
|
|
|
public override void OnAwake()
|
|
|
|
{
|
|
|
|
_customer = GetComponent<Customer>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnStart()
|
|
|
|
{
|
|
|
|
_customer.MoveMoneyCounter();
|
|
|
|
var random = Random.Range(0f, 100f);
|
|
|
|
if (random <= TycoonManager.Instance.TycoonStageController.StageDataSo.VomitingPercent)
|
|
|
|
{
|
|
|
|
_canVomit = true;
|
2024-12-03 06:08:15 +00:00
|
|
|
_vomitingPosition = Utils.RandomPositionOnGraph(1);
|
2024-11-11 02:02:24 +00:00
|
|
|
_customer.AIMovement.Move(_vomitingPosition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override TaskStatus OnUpdate()
|
|
|
|
{
|
|
|
|
return _canVomit ? TaskStatus.Success : TaskStatus.Failure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|