mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-01-31 07:48:27 +08:00
Time.Freeze
This commit is contained in:
parent
e21106ccca
commit
d08d48147e
13
src/Game.bf
13
src/Game.bf
@ -159,11 +159,16 @@ namespace Strawberry
|
||||
scene.Started();
|
||||
}
|
||||
|
||||
if (scene != null)
|
||||
scene.Update();
|
||||
if (Time.Freeze > 0)
|
||||
Time.Freeze -= Time.RawDelta;
|
||||
else
|
||||
{
|
||||
if (scene != null)
|
||||
scene.Update();
|
||||
|
||||
Time.PreviousElapsed = Time.Elapsed;
|
||||
Time.Elapsed += Time.Delta;
|
||||
Time.PreviousElapsed = Time.Elapsed;
|
||||
Time.Elapsed += Time.Delta;
|
||||
}
|
||||
}
|
||||
|
||||
public void Render()
|
||||
|
19
src/Scene.bf
19
src/Scene.bf
@ -105,23 +105,8 @@ namespace Strawberry
|
||||
|
||||
// Time
|
||||
|
||||
public float TimeElapsed
|
||||
{
|
||||
[Inline]
|
||||
get
|
||||
{
|
||||
return Time.Elapsed - TimeStarted;
|
||||
}
|
||||
}
|
||||
|
||||
public float PreviousTimeElapsed
|
||||
{
|
||||
[Inline]
|
||||
get
|
||||
{
|
||||
return Time.PreviousElapsed - TimeStarted;
|
||||
}
|
||||
}
|
||||
public float TimeElapsed => Time.Elapsed - TimeStarted;
|
||||
public float PreviousTimeElapsed => Time.PreviousElapsed - TimeStarted;
|
||||
|
||||
public bool TimeOnInterval(float interval, float offset = 0)
|
||||
{
|
||||
|
@ -4,7 +4,11 @@ namespace Strawberry
|
||||
{
|
||||
static public float Elapsed;
|
||||
static public float PreviousElapsed;
|
||||
static public float Delta = 1 / 60f;
|
||||
static public float Rate = 1f;
|
||||
static public float Freeze;
|
||||
|
||||
static public float RawDelta => (1 / 60f);
|
||||
static public float Delta => RawDelta * Rate;
|
||||
|
||||
static public bool OnInterval(float interval, float offset = 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user