ProjectDDD/Assets/_DDD/_Scripts/Restaurant/State/FlowStates/RestaurantRunState.cs
2025-09-02 21:34:18 +09:00

52 lines
1.4 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
public class RestaurantRunState : ScriptableObject
{
private Vector3 _spawnPoint = new(5f, 0f, 4f);
public Vector3 SpawnPoint => _spawnPoint;
private List<GameObject> _activeCustomers = new();
private bool _spawnCompleted;
public void InitializeSpawnPoint(Vector3 spawnPoint)
{
_spawnPoint = spawnPoint;
}
public void AddCustomer(GameObject customer)
{
if (_activeCustomers.Contains(customer) == false)
{
_activeCustomers.Add(customer);
}
}
public void RemoveCustomer(GameObject customer)
{
_activeCustomers.Remove(customer);
}
public void SetSpawnCompleted(bool completed)
{
_spawnCompleted = completed;
}
public bool AllCustomersGone()
{
// null 체크 후 실제로 활성화된 손님이 없는지 확인
_activeCustomers.RemoveAll(customer => customer == null);
return _activeCustomers.Count == 0;
}
public void ClearCustomers()
{
_activeCustomers.Clear();
_spawnCompleted = false;
}
public bool GetSpawnCompleted() => _spawnCompleted;
}
}