+ Time controls (Stopwatch, Timers, Intervals) + Added smmeries to everything in SM.Base ~ Renamed Vectors to CVectors.
46 lines
No EOL
1.4 KiB
C#
46 lines
No EOL
1.4 KiB
C#
namespace SM.Utility
|
|
{
|
|
/// <summary>
|
|
/// A assistant to control the delta time.
|
|
/// </summary>
|
|
public class Deltatime
|
|
{
|
|
/// <summary>
|
|
/// The current update delta time.
|
|
/// </summary>
|
|
public static float UpdateDelta { get; internal set; }
|
|
/// <summary>
|
|
/// The current render delta time.
|
|
/// </summary>
|
|
public static float RenderDelta { get; internal set; }
|
|
|
|
/// <summary>
|
|
/// If true, it uses <see cref="RenderDelta"/>, otherwise <see cref="UpdateDelta"/>.
|
|
/// <para>Default: false</para>
|
|
/// </summary>
|
|
public bool UseRender;
|
|
/// <summary>
|
|
/// Scaling of the delta time.
|
|
/// <para>Default: 1</para>
|
|
/// </summary>
|
|
public float Scale;
|
|
|
|
/// <summary>
|
|
/// The calculated delta time.
|
|
/// </summary>
|
|
public float DeltaTime => (UseRender ? RenderDelta : UpdateDelta) * Scale;
|
|
|
|
/// <summary>
|
|
/// Creates a delta time assistant.
|
|
/// </summary>
|
|
/// <param name="scale">The start scale for the delta time. Default: 1</param>
|
|
/// <param name="useRender">If true, it uses <see cref="RenderDelta"/>, otherwise <see cref="UpdateDelta"/>. Default: false</param>
|
|
public Deltatime(float scale = 1, bool useRender = false)
|
|
{
|
|
UseRender = useRender;
|
|
Scale = scale;
|
|
}
|
|
|
|
|
|
}
|
|
} |