CapersProject/Assets/02.Scripts/Prop/Tycoon/CustomerTable.cs

29 lines
771 B
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace BlueWater.Tycoons
{
public class CustomerTable : MonoBehaviour
{
[SerializeField]
private List<TableSeat> _tableSeats;
private void OnEnable()
{
TycoonManager.Instance.CustomerTableManager.RegisterTable(this);
}
private void OnDisable()
{
if (!TycoonManager.Instance) return;
TycoonManager.Instance.CustomerTableManager.UnregisterTable(this);
}
public TableSeat FindEmptySeat()
{
return _tableSeats.FirstOrDefault(tableSeat => !tableSeat.IsReserved && !tableSeat.IsOccupied && tableSeat.IsCleaned);
}
}
}