using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace BlueWaterProject { public class Toilet : MonoBehaviour { private InShipMapInfo inShipMapInfo; [field: SerializeField] public bool IsUsed { get; set; } [SerializeField] private int toiletGauge = 0; private int toiletMaxGauge = 100; private void Awake() { inShipMapInfo = GameObject.Find("InShipMap").GetComponent(); inShipMapInfo.Toilets.Add(this); } public Transform UseToilet() { if (IsUsed) return null; if (toiletGauge >= toiletMaxGauge) { ToiletFull(); return null; } IsUsed = true; StartCoroutine(ToiletGaugeUp()); return transform; } private void ToiletFull() { // TODO 화장실게이지가 꽉 찼을 때 이벤트 } IEnumerator ToiletGaugeUp() { while (true) { yield return new WaitForSeconds(1f); toiletGauge += 5; IsUsed = false; break; } } } }