查看:MyTool.Static.TriggerMarker标记\计时方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyTool.Dynamic
{
///
/// 标记,累加器
///
public class TriggerMarker
{
private bool Switch = false;
private bool bit = false;
private bool trigger = false;
private float Count = 0;
private DateTime LastTime ;
///
/// 重置标记器
///
public void Reset_TriggerMarke()
{
Switch = false;
bit = false;
trigger = false;
Count = 0;
LastTime = DateTime.Now;
}
///
/// 边缘检测:检测Switch是否发生变化,触发标记变成true一次 ; (false/true)用[与+!]运算过滤上下边缘
///
/// 标记开关
/// return : 触发标记
public bool _Edge(bool Switch)
{
return MyTool.Static.TriggerMarker.Edge(Switch, ref bit);
}
///
/// T触发器:Switch间隔变成true,可改变触发标记状态(false/true)
///
/// 标记开关
/// return : 触发标记
public bool _Trigger(bool Switch)
{
return MyTool.Static.TriggerMarker.Trigger(Switch, ref bit, ref trigger);
}
///
/// 计数器:计算执行次数,需要手动清零
///
/// 设定数
///
public bool _Count(float Cumulative, int targetCount)
{
return MyTool.Static.TriggerMarker.Count(ref Count, Cumulative ,targetCount);
}
///
/// 计时器:计算执行时间,需要手动清零
///
/// 定时
///
public bool _Clock( float targetSeconds)
{
return MyTool.Static.TriggerMarker.Clock(ref LastTime, targetSeconds);
}
}
}
查看:MyTool.Static.TriggerMarker标记\计时方法