You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
1.1 KiB

using CoreGame;
namespace CoreGame.Render
{
public class Trigger_NoMovementTime : TriggerBase
{
// self.fParam1 触发计时器(开始不移动的时间)
// triggerCfg.Param1 未移动时长大于X秒触发,万分比,10000代表1秒
// 到达时长后若继续不动则每帧接着触发
public override void OnEvent(TriggerSpec self, int eventId, object param1)
{
// param1 == null时为人物移动了
if (self.param1.floatVal <= 0f || param1 == null)
{
self.param1.floatVal = GameTime.GetRenderTime();
}
if (GameTime.GetRenderTime() - self.param1.floatVal >= triggerCfg.param1 * 0.0001f)
{
OnTrigger(self, eventId, param1);
}
}
public override void Init(TriggerSpec self)
{
RegEntityEvent(self, ClientEvent.NoMovementTime);
}
public override void UnInit(TriggerSpec self)
{
UnRegEntityEvent(self, ClientEvent.NoMovementTime);
}
}
}