+ 화면 밖에서 손님이 요구하는 중일 때, Indicator를 통해서 Ui 표시 + Open, Closed Ui 추가 및 기능 연결 + 테이블 찾는 로직 변경 (전부 랜덤) - 기존에는 항상 같은 순서로 자리를 채움 + 통계용 데이터 CustomerVisitInfo 추가 (추후에 통계Ui 생길 때 연결) + 대화 조건 변경 + 일부 가구들 상호작용 조건 변경 + Outline shader Render Face(Front -> Both 변경 - Front면 x축 뒤집는 경우 안나옴) + GraphicMaterialOverride를 사용하는 경우, 에디터에서 전체화면 등 특정 상황에서 material이 사라지는 버그 수정 + InteractionFuniture Open, Closed 공통 기능으로 병합
97 lines
3.2 KiB
C#
97 lines
3.2 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 FoodBalloonUi _foodBalloonUi;
|
|
private int _goldIdx;
|
|
private bool _isPaidMoney;
|
|
|
|
public override void OnAwake()
|
|
{
|
|
_customer = GetComponent<Customer>();
|
|
_customerData = _customer.CustomerData;
|
|
}
|
|
|
|
public override void OnStart()
|
|
{
|
|
_foodBalloonUi = _customer.FoodBalloonUi;
|
|
_foodBalloonUi.PayMoney(_customerData.WaitTime, _customerData.HurryTime);
|
|
_customer.OnInteraction += HandlePayMoneyInteraction;
|
|
_customer.RegisterPlayerInteraction();
|
|
}
|
|
|
|
public override TaskStatus OnUpdate()
|
|
{
|
|
if (_isPaidMoney)
|
|
{
|
|
return TaskStatus.Success;
|
|
}
|
|
|
|
if (_foodBalloonUi.IsWaitTimeOver())
|
|
{
|
|
_customer.OnInteraction -= HandlePayMoneyInteraction;
|
|
_customer.UnregisterPlayerInteraction();
|
|
_foodBalloonUi.CancelOrder();
|
|
_foodBalloonUi.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);
|
|
_foodBalloonUi.HideUi();
|
|
_customer.OnInteraction -= HandlePayMoneyInteraction;
|
|
_customer.Bark(barkName, BarkOrder.FirstValid);
|
|
_customer.UnregisterPlayerInteraction();
|
|
_foodBalloonUi.CancelOrder();
|
|
|
|
_isPaidMoney = true;
|
|
}
|
|
}
|
|
} |