97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
using System;
|
|
using BehaviorDesigner.Runtime.Tasks;
|
|
using BlueWater.Npcs.Customers;
|
|
using BlueWater.Uis;
|
|
using PixelCrushers.DialogueSystem;
|
|
|
|
namespace BlueWater.BehaviorTrees.Actions
|
|
{
|
|
[TaskCategory("Custom/Npc/Customer")]
|
|
[Serializable]
|
|
public class PayMoney : Conditional
|
|
{
|
|
// private Customer _customer;
|
|
// private CustomerData _customerData;
|
|
// private BalloonUi _balloonUi;
|
|
// private int _goldIdx;
|
|
// private bool _isPaidMoney;
|
|
//
|
|
// public override void OnAwake()
|
|
// {
|
|
// _customer = GetComponent<Customer>();
|
|
// _customerData = _customer.CustomerData;
|
|
// }
|
|
//
|
|
// public override void OnStart()
|
|
// {
|
|
// _balloonUi = _customer.BalloonUi;
|
|
// _balloonUi.PayMoney(_customerData.WaitTime, _customerData.HurryTime);
|
|
// _customer.OnInteraction += HandlePayMoneyInteraction;
|
|
// _customer.RegisterPlayerInteraction();
|
|
// }
|
|
//
|
|
// public override TaskStatus OnUpdate()
|
|
// {
|
|
// if (_isPaidMoney)
|
|
// {
|
|
// return TaskStatus.Success;
|
|
// }
|
|
//
|
|
// if (_balloonUi.IsWaitTimeOver())
|
|
// {
|
|
// _customer.OnInteraction -= HandlePayMoneyInteraction;
|
|
// _customer.UnregisterPlayerInteraction();
|
|
// _balloonUi.CancelOrder();
|
|
// _balloonUi.HideUi();
|
|
// // _customer.AddHappyPoint(-3);
|
|
// // if (_customer.HappyPoint <= 0)
|
|
// // {
|
|
// // _foodBalloonUi.CancelOrder();
|
|
// // _customer.Bark("CancelOrder");
|
|
// // }
|
|
// return TaskStatus.Failure;
|
|
// }
|
|
//
|
|
// return TaskStatus.Running;
|
|
// }
|
|
//
|
|
// private void HandlePayMoneyInteraction()
|
|
// {
|
|
// var tycoonPlayer = GameManager.Instance.CurrentTycoonPlayer;
|
|
// var foodPrice = _customer.ItemData.Price;
|
|
// float tipCoefficient;
|
|
// string barkName;
|
|
// switch (_customer.HappyPoint)
|
|
// {
|
|
// case >= 3:
|
|
// tipCoefficient = 2f;
|
|
// barkName = "SatisfactoryEvaluation";
|
|
// break;
|
|
// case >= 2:
|
|
// tipCoefficient = 1.5f;
|
|
// barkName = "MediocreEvaluation";
|
|
// break;
|
|
// case >= 1:
|
|
// tipCoefficient = 1.1f;
|
|
// barkName = "MediocreEvaluation";
|
|
// break;
|
|
// default:
|
|
// tipCoefficient = 1f;
|
|
// barkName = "UnsatisfactoryEvaluation";
|
|
// break;
|
|
// }
|
|
//
|
|
// var tipAmount = foodPrice * (int)tipCoefficient;
|
|
// var paidAmount = foodPrice + tipAmount;
|
|
// tycoonPlayer.GetMoney(paidAmount);
|
|
// _customer.PayMoney(foodPrice, tipAmount);
|
|
// _balloonUi.HideUi();
|
|
// _customer.OnInteraction -= HandlePayMoneyInteraction;
|
|
// _customer.Bark(barkName, BarkOrder.FirstValid);
|
|
// _customer.UnregisterPlayerInteraction();
|
|
// _balloonUi.CancelOrder();
|
|
//
|
|
// _isPaidMoney = true;
|
|
// }
|
|
}
|
|
} |