43 lines
873 B
C#
43 lines
873 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
namespace Thousandto.Code.Logic
|
|
{
|
|
/// <summary>
|
|
/// 冻结Input消息的处理器
|
|
/// </summary>
|
|
public class FreezeInputHandler
|
|
{
|
|
//冻结时间
|
|
private float _freezeTime = 0;
|
|
|
|
//是否冻结
|
|
public bool IsFreezed
|
|
{
|
|
get
|
|
{
|
|
return _freezeTime > 0;
|
|
}
|
|
}
|
|
|
|
//冻结Input的时间
|
|
public void FreezeInput(float time = float.MaxValue)
|
|
{
|
|
_freezeTime = time;
|
|
}
|
|
|
|
//检验是否冻结,true:表示没有冻结,false表示冻结
|
|
public bool Update(float deltaTime)
|
|
{
|
|
if (_freezeTime > 0)
|
|
{
|
|
_freezeTime -= deltaTime;
|
|
}
|
|
return _freezeTime <= 0;
|
|
}
|
|
|
|
}
|
|
}
|