1
This commit is contained in:
28
Packages/Core/DataRecorder/DataRecorder.cs
Normal file
28
Packages/Core/DataRecorder/DataRecorder.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Timer = System.Timers.Timer;
|
||||
using System.Timers;
|
||||
using System.Threading;
|
||||
namespace BITKit.IData
|
||||
{
|
||||
public class DataRecorder<T> : Player<T>
|
||||
{
|
||||
public int minLength;
|
||||
public event Action<List<T>> output;
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
list.Add(current);
|
||||
}
|
||||
protected override void OnStart()
|
||||
{
|
||||
list.Clear();
|
||||
}
|
||||
protected override void OnStop()
|
||||
{
|
||||
if (list.Count >= minLength)
|
||||
output.Invoke(list);
|
||||
list.Clear();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user