using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using TMPro;
|
using UnityEngine;
|
|
public class BossWarning : MonoBehaviour
|
{
|
/// <summary>
|
/// 对应的时间显示
|
/// </summary>
|
public TextMeshProUGUI timeText;
|
|
protected int lastIntSec = 0;
|
protected float timeDisSec = 0;
|
|
// Start is called before the first frame update
|
void Start()
|
{
|
|
}
|
|
/// <summary>
|
/// 设置倒计时的时间.
|
/// </summary>
|
/// <param name="cdtime"></param>
|
public void setCountDownTime( float cdtime)
|
{
|
timeDisSec = cdtime;
|
lastIntSec = (int)Math.Ceiling(cdtime);
|
timeText.text = lastIntSec.ToString() + "s";
|
}
|
|
// Update is called once per frame
|
void Update()
|
{
|
timeDisSec -= Time.deltaTime;
|
int tint = (int)Math.Ceiling(timeDisSec);
|
if (tint < 1)
|
tint = 1;
|
if( tint != lastIntSec)
|
{
|
lastIntSec = tint;
|
timeText.text = lastIntSec.ToString() + "s";
|
}
|
}
|
}
|