mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-26 06:09:02 +00:00
Make Conductor a lazy instance
This commit is contained in:
parent
4524b66170
commit
2b477c9bd1
|
|
@ -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,
|
* 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.
|
* 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.
|
* Signal fired when the current Conductor instance advances to a new measure.
|
||||||
|
|
@ -505,6 +513,6 @@ class Conductor
|
||||||
*/
|
*/
|
||||||
public static function reset():Void
|
public static function reset():Void
|
||||||
{
|
{
|
||||||
Conductor.instance = new Conductor();
|
_instance = new Conductor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue