use modular initing system rather than calling Init() method.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Timing
|
||||
@@ -53,24 +54,31 @@ namespace StgSharp.Timing
|
||||
|
||||
public virtual bool IsComplete
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _timeProvider.CurrentSecond > _ending;
|
||||
}
|
||||
|
||||
public Func<float, float> TimeRelatedCalculation
|
||||
{
|
||||
get { return _timeRelatedCalculation; }
|
||||
set { _timeRelatedCalculation = value; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _timeRelatedCalculation;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => _timeRelatedCalculation = value;
|
||||
}
|
||||
|
||||
public static TimeFunction One
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => new TimeFunctionOne();
|
||||
}
|
||||
|
||||
public TimeSpanProvider TimeSpanProvider
|
||||
{
|
||||
get { return _timeProvider; }
|
||||
set { _timeProvider = value; }
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _timeProvider;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => _timeProvider = value;
|
||||
}
|
||||
|
||||
public virtual float Calculate()
|
||||
@@ -96,7 +104,7 @@ namespace StgSharp.Timing
|
||||
return new TimeFunction(_timeProvider, func, range);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
public virtual void Reset()
|
||||
{
|
||||
float range = _ending - _beginning;
|
||||
_beginning = _timeProvider.CurrentSecond;
|
||||
@@ -117,10 +125,7 @@ namespace StgSharp.Timing
|
||||
|
||||
internal TimeFunctionOne() : base() { }
|
||||
|
||||
public override bool IsComplete
|
||||
{
|
||||
get => true;
|
||||
}
|
||||
public override bool IsComplete => true;
|
||||
|
||||
public override float Calculate()
|
||||
{
|
||||
@@ -138,9 +143,9 @@ namespace StgSharp.Timing
|
||||
}
|
||||
|
||||
#pragma warning disable CA1822
|
||||
public new void Reset()
|
||||
public override void Reset()
|
||||
{
|
||||
}
|
||||
#pragma warning restore CA1822
|
||||
{ }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user