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