OldBlueWater/BlueWater/Assets/02.Scripts/Props/Toilet.cs

54 lines
1.3 KiB
C#

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>();
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;
}
}
}
}