2023-11-23 17:52:14 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
|
|
|
public class Toilet : MonoBehaviour
|
|
|
|
{
|
2023-11-24 02:15:02 +00:00
|
|
|
private InShipMapInfo inShipMapInfo;
|
|
|
|
|
2023-11-23 17:52:14 +00:00
|
|
|
[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>();
|
2023-11-24 02:15:02 +00:00
|
|
|
inShipMapInfo.Toilets.Add(this);
|
2023-11-23 17:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public Transform UseToilet()
|
|
|
|
{
|
|
|
|
if (IsUsed) return null;
|
|
|
|
if (toiletGauge >= toiletMaxGauge)
|
|
|
|
{
|
|
|
|
ToiletFull();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
IsUsed = true;
|
|
|
|
StartCoroutine(ToiletGaugeUp());
|
|
|
|
return transform;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ToiletFull()
|
|
|
|
{
|
2023-11-24 02:15:02 +00:00
|
|
|
// TODO 화장실게이지가 꽉 찼을 때 이벤트
|
2023-11-23 17:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
IEnumerator ToiletGaugeUp()
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
yield return new WaitForSeconds(1f);
|
|
|
|
toiletGauge += 5;
|
|
|
|
IsUsed = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|