2023-12-28 05:42:54 +00:00
|
|
|
using System;
|
2024-01-28 08:21:10 +00:00
|
|
|
using PixelCrushers.DialogueSystem;
|
2024-01-02 08:17:10 +00:00
|
|
|
using Sirenix.OdinInspector;
|
2024-01-18 09:01:04 +00:00
|
|
|
using TMPro;
|
2023-12-28 05:42:54 +00:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.AI;
|
2024-01-02 08:17:10 +00:00
|
|
|
using UnityEngine.UI;
|
2023-12-28 05:42:54 +00:00
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
|
|
|
public class TycoonNpc : MonoBehaviour
|
|
|
|
{
|
2024-01-02 08:17:10 +00:00
|
|
|
public NpcStateMachine StateMachine { get; set; }
|
|
|
|
public NavMeshAgent Agent { get; set; }
|
|
|
|
public Transform VisaualLook { get; set; }
|
|
|
|
public TycoonMapInfo MapInfo { get; set; }
|
|
|
|
|
|
|
|
[Title("FindTableState")]
|
|
|
|
public bool DoSeat { get; set; }
|
|
|
|
public Seat AssignedSeat { get; set; }
|
2023-12-28 05:42:54 +00:00
|
|
|
|
2024-01-02 08:17:10 +00:00
|
|
|
[Title("FoodOrderState")]
|
|
|
|
public Image BarkImg { get; set; }
|
|
|
|
public Image BarkFillImg { get; set; }
|
|
|
|
public Image FoodImg { get; set; }
|
|
|
|
public Transform EmojiTransform { get; set; }
|
2024-01-03 02:54:03 +00:00
|
|
|
public bool IsGetFood { get; set; }
|
2024-01-22 03:06:16 +00:00
|
|
|
public bool IsGetDrink { get; set; }
|
2024-01-18 09:01:04 +00:00
|
|
|
|
|
|
|
[Title("PayState")]
|
|
|
|
public PayController PayController { get; set; }
|
|
|
|
public GameObject PayTextObj { get; set; }
|
|
|
|
public TextMeshProUGUI PayText { get; set; }
|
|
|
|
public Animator PayTextAni { get; set; }
|
2024-01-24 01:21:07 +00:00
|
|
|
public int Satisfaction { get; set; } = 25;
|
2023-12-28 05:42:54 +00:00
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
2024-01-02 08:17:10 +00:00
|
|
|
Agent = GetComponent<NavMeshAgent>();
|
|
|
|
Agent.updateRotation = false;
|
|
|
|
MapInfo = GameObject.Find("MapInfo").GetComponent<TycoonMapInfo>();
|
|
|
|
|
|
|
|
BarkImg = transform.Find("Canvas/BarkImg").GetComponent<Image>();
|
|
|
|
BarkFillImg = transform.Find("Canvas/BarkFillImg").GetComponent<Image>();
|
|
|
|
FoodImg = transform.Find("Canvas/FoodImg").GetComponent<Image>();
|
|
|
|
EmojiTransform = transform.Find("Emoji");
|
2024-01-18 09:01:04 +00:00
|
|
|
|
|
|
|
PayController = MapInfo.Counter.GetComponent<PayController>();
|
|
|
|
PayTextObj = transform.Find("Canvas/PayText").gameObject;
|
|
|
|
PayText = PayTextObj.GetComponent<TextMeshProUGUI>();
|
|
|
|
PayTextAni = PayTextObj.GetComponent<Animator>();
|
2023-12-28 05:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
2024-01-02 08:17:10 +00:00
|
|
|
StateMachine = gameObject.AddComponent<NpcStateMachine>();
|
2023-12-28 05:42:54 +00:00
|
|
|
|
2024-01-02 08:17:10 +00:00
|
|
|
var findTableState = new FindTableState(this);
|
|
|
|
StateMachine.ChangeState(findTableState);
|
2023-12-28 05:42:54 +00:00
|
|
|
}
|
2024-01-24 01:21:07 +00:00
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
2024-01-28 08:21:10 +00:00
|
|
|
DialogueLua.SetVariable("Satisfaction", Satisfaction);
|
|
|
|
|
2024-01-24 01:21:07 +00:00
|
|
|
if (Satisfaction <= -1)
|
|
|
|
{
|
|
|
|
var walkOutState = new WalkOutSate(this);
|
|
|
|
StateMachine.ChangeState(walkOutState);
|
|
|
|
}
|
|
|
|
}
|
2023-12-28 05:42:54 +00:00
|
|
|
}
|
|
|
|
}
|