more optimization

This commit is contained in:
Yoshman29
2023-01-09 17:36:27 +01:00
parent 3d89c13b1b
commit 4e5a316001
6 changed files with 32 additions and 7 deletions
+17
View File
@@ -1,5 +1,7 @@
package funkin.scripting;
import flixel.FlxG;
import flixel.FlxState;
import funkin.scripting.events.*;
class EventManager {
@@ -19,4 +21,19 @@ class EventManager {
return cast eventValues[index];
}
public static function reset() {
for(v in eventValues)
v.destroy();
eventValues = [];
eventKeys = [];
}
public static function init() {
FlxG.signals.preStateCreate.add(onStateSwitch);
}
private static inline function onStateSwitch(newState:FlxState)
reset();
}