mr-crocs-adventures/js/effects/FullscreenEffectFactory.js

31 lines
574 B
JavaScript

import {SnowEffect} from "./SnowEffect.js";
import {RainEffect} from "./RainEffect.js";
import {ThunderstormEffect} from "./ThunderstormEffect.js";
export class FullscreenEffectFactory
{
static EFFECTS = {
[SnowEffect.NAME]: SnowEffect,
[RainEffect.NAME]: RainEffect,
[ThunderstormEffect.NAME]: ThunderstormEffect,
}
getEffect(name)
{
return new FullscreenEffectFactory.EFFECTS[name]();
}
static getNames()
{
const names = [];
for (const name in FullscreenEffectFactory.EFFECTS) {
names.push(name);
}
console.log(names);
return names;
}
}