mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-03-21 20:39:52 -04:00
Make Conductor a lazy instance
This commit is contained in:
parent
4524b66170
commit
2b477c9bd1
1 changed files with 10 additions and 2 deletions
|
@ -36,7 +36,15 @@ class Conductor
|
|||
* You can also do stuff like store a reference to the Conductor and pass it around or temporarily replace it,
|
||||
* or have a second Conductor running at the same time, or other weird stuff like that if you need to.
|
||||
*/
|
||||
public static var instance:Conductor = new Conductor();
|
||||
public static var instance(get, never):Conductor;
|
||||
|
||||
static var _instance:Null<Conductor> = null;
|
||||
|
||||
static function get_instance():Conductor
|
||||
{
|
||||
if (_instance == null) _instance = new Conductor();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal fired when the current Conductor instance advances to a new measure.
|
||||
|
@ -505,6 +513,6 @@ class Conductor
|
|||
*/
|
||||
public static function reset():Void
|
||||
{
|
||||
Conductor.instance = new Conductor();
|
||||
_instance = new Conductor();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue