34 lines
930 B
C#
34 lines
930 B
C#
namespace ET
|
|
{
|
|
public class FixedTimeCounter: Object
|
|
{
|
|
private long startTime;
|
|
private int startFrame;
|
|
public int Interval { get; private set; }
|
|
|
|
public FixedTimeCounter(long startTime, int startFrame, int interval)
|
|
{
|
|
this.startTime = startTime;
|
|
this.startFrame = startFrame;
|
|
this.Interval = interval;
|
|
}
|
|
|
|
public void ChangeInterval(int interval, int frame)
|
|
{
|
|
this.startTime += (frame - this.startFrame) * this.Interval;
|
|
this.startFrame = frame;
|
|
this.Interval = interval;
|
|
}
|
|
|
|
public long FrameTime(int frame)
|
|
{
|
|
return this.startTime + (frame - this.startFrame) * this.Interval;
|
|
}
|
|
|
|
public void Reset(long time, int frame)
|
|
{
|
|
this.startTime = time;
|
|
this.startFrame = frame;
|
|
}
|
|
}
|
|
} |