31 lines
651 B
JavaScript
31 lines
651 B
JavaScript
// SceneFeatureManager.js
|
|
|
|
class SceneFeatureManager {
|
|
constructor() {
|
|
if (SceneFeatureManager.instance) {
|
|
return SceneFeatureManager.instance;
|
|
}
|
|
|
|
this.features = [];
|
|
SceneFeatureManager.instance = this;
|
|
}
|
|
|
|
register(feature) {
|
|
this.features.push(feature);
|
|
}
|
|
|
|
init() {
|
|
for (const feature of this.features) {
|
|
feature.init();
|
|
}
|
|
}
|
|
|
|
update(deltaTime) {
|
|
for (const feature of this.features) {
|
|
feature.update(deltaTime);
|
|
}
|
|
}
|
|
}
|
|
|
|
const sceneFeatureManager = new SceneFeatureManager();
|
|
export default sceneFeatureManager; |