Minor changes to EffectMaker

This commit is contained in:
loplkc loplkc 2022-02-11 20:27:30 -05:00
parent b1a1bb6013
commit f48eff5f67

View file

@ -57,12 +57,13 @@ class effectHandler implements effectMaker, effectRunner {
} }
particleEffect() {} particleEffect() {}
runEffects(timeSinceLastFrame: number) { runEffects(timeSinceLastFrame: number) {
let effectsToRun = this.effectsToRun let effectsToRun = this.effectsToRun;
print(tostring(effectsToRun.size()) + " effects to run.");
for (const effect of effectsToRun) { for (const effect of effectsToRun) {
// Update the effect time // Update the effect time
let timeSinceLastKeypoint = effect[0] + timeSinceLastFrame;
let nextKeypoint = effect[1][1]; let nextKeypoint = effect[1][1];
let timeOfNextKeypoint = nextKeypoint[0]; let timeOfNextKeypoint = nextKeypoint[0];
let timeSinceLastKeypoint = effect[0] + timeSinceLastFrame;
while (timeSinceLastKeypoint >= timeOfNextKeypoint) { while (timeSinceLastKeypoint >= timeOfNextKeypoint) {
if (effect[1][2]) { if (effect[1][2]) {
timeSinceLastKeypoint -= timeOfNextKeypoint; timeSinceLastKeypoint -= timeOfNextKeypoint;
@ -70,13 +71,12 @@ class effectHandler implements effectMaker, effectRunner {
nextKeypoint = effect[1][1]; nextKeypoint = effect[1][1];
timeOfNextKeypoint = nextKeypoint[0]; timeOfNextKeypoint = nextKeypoint[0];
} else { } else {
effect[2].Destroy() effect[2].Destroy();
effectsToRun.remove(0) effectsToRun.remove(0);
continue // Move on if this effect is done continue; // Move on if this effect is done
} }
} }
effect[0] = timeSinceLastKeypoint; effect[0] = timeSinceLastKeypoint;
// Get the rest of the variables
const currentKeypoint = effect[1][0]; const currentKeypoint = effect[1][0];
const easingStyle = currentKeypoint[5]; const easingStyle = currentKeypoint[5];
const meshPart = effect[2]; const meshPart = effect[2];