2024-06-18 18:16:19 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2024-07-02 18:27:56 +00:00
|
|
|
namespace BlueWater.Tycoons
|
2024-06-18 18:16:19 +00:00
|
|
|
{
|
|
|
|
public class CustomerTable : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField]
|
|
|
|
private List<TableSeat> _tableSeats;
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
{
|
2024-07-08 20:06:22 +00:00
|
|
|
TycoonManager.Instance.CustomerTableController.RegisterTable(this);
|
2024-06-18 18:16:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
{
|
2024-07-02 18:27:56 +00:00
|
|
|
if (!TycoonManager.Instance) return;
|
2024-06-18 18:16:19 +00:00
|
|
|
|
2024-07-08 20:06:22 +00:00
|
|
|
TycoonManager.Instance.CustomerTableController.UnregisterTable(this);
|
2024-06-18 18:16:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public TableSeat FindEmptySeat()
|
|
|
|
{
|
|
|
|
return _tableSeats.FirstOrDefault(tableSeat => !tableSeat.IsReserved && !tableSeat.IsOccupied && tableSeat.IsCleaned);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|