_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/HegemonTime.cs
2024-11-15 15:07:55 +08:00

62 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HegemonTime : MonoBehaviour
{
public static HegemonTime instance;
public Text timeText;
public int timeNum;
public int carrySeconds;
public GameObject InfoObject;
public AllHouseContro allHouseContro;
// Start is called before the first frame update
void Start()
{
instance = this;
//StartCoroutine(StartGame());
}
private void Update()
{
//Debug.Log("carrySeconds:" + InfoObject.GetComponent<selectGameEscape512>().carrySeconds);
}
public IEnumerator StartGame()
{
allHouseContro.ControAllDoorOpen();
while (timeNum >=0)
{
timeText.text = (timeNum).ToString(); // 显示整数秒数
yield return new WaitForSeconds(1f); // 等待1秒
timeNum -= 1;
if (timeNum<= int.Parse(InfoObject.GetComponent<selectLatest511>().betTime)&&InfoObject.GetComponent<selectLatest511>().status==1)//停止下注,关门
{
allHouseContro.ControAllDoorClose();
MaskContro.instance.SetMask(true);
}
if (timeNum<20- int.Parse(InfoObject.GetComponent<selectLatest511>().countTime))//boos出现
{
Debug.Log("Boos来了");
BossContro.instance.BossMove();
}
}
//timeNum = 60;
}
public void HadInfAndStartGame()//启动倒计时
{
timeNum =int.Parse(InfoObject.GetComponent<selectLatest511>().startTime);
StartCoroutine(StartGame());
}
}