先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace GameCore
|
|
{
|
|
public class WaitingUI : MonoBehaviour
|
|
{
|
|
public float Speed = 200;
|
|
public Action OnTimeOut;
|
|
|
|
float _timer;
|
|
float _rotZ;
|
|
bool _isTimeOutTriggered = false;
|
|
|
|
void OnEnable()
|
|
{
|
|
Trigger();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (_timer > 0f)
|
|
{
|
|
_timer -= Time.unscaledDeltaTime;
|
|
}
|
|
else
|
|
{
|
|
if (!_isTimeOutTriggered)
|
|
{
|
|
_isTimeOutTriggered = true;
|
|
OnTimeOut?.Invoke();
|
|
}
|
|
}
|
|
|
|
_rotZ -= Time.unscaledDeltaTime * Speed;
|
|
transform.rotation = Quaternion.Euler(0, 0, _rotZ);
|
|
}
|
|
|
|
void Trigger()
|
|
{
|
|
_timer = UIManager.TIME_OUT_MS * 0.001f;
|
|
_isTimeOutTriggered = false;
|
|
}
|
|
|
|
public void ResetTimeout(float time_out)
|
|
{
|
|
_timer = time_out;
|
|
}
|
|
|
|
// time_out_ms < 0 means keep showing and no time out trigger
|
|
public void Show(int time_out_ms)
|
|
{
|
|
if (time_out_ms > 0)
|
|
{
|
|
_timer = time_out_ms * 0.001f;
|
|
}
|
|
else
|
|
{
|
|
_timer = time_out_ms;
|
|
_isTimeOutTriggered = true; // Won't trigger time out event
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|