Fix: torches toggle
This commit is contained in:
parent
47b7645046
commit
edbed229b3
@ -103,10 +103,7 @@ export class ConfigUI extends SceneFeature {
|
||||
};
|
||||
|
||||
// Torches Toggle
|
||||
createToggle('Stage Torches', 'torchesEnabled', (enabled) => {
|
||||
const torches = sceneFeatureManager.features.find(f => f.constructor.name === 'StageTorches');
|
||||
if (torches && torches.group) torches.group.visible = enabled;
|
||||
});
|
||||
createToggle('Stage Torches', 'torchesEnabled');
|
||||
|
||||
// Lasers Toggle
|
||||
createToggle('Lasers', 'lasersEnabled');
|
||||
|
||||
@ -38,7 +38,7 @@ export class StageTorches extends SceneFeature {
|
||||
createTorch(position) {
|
||||
const torchGroup = new THREE.Group();
|
||||
torchGroup.position.copy(position);
|
||||
torchGroup.visible = false; // Start invisible
|
||||
torchGroup.visible = state.config.torchesEnabled;
|
||||
|
||||
// --- Torch Holder ---
|
||||
const holderMaterial = new THREE.MeshStandardMaterial({ color: 0x333333, roughness: 0.6, metalness: 0.5 });
|
||||
@ -55,6 +55,7 @@ export class StageTorches extends SceneFeature {
|
||||
pointLight.castShadow = true;
|
||||
pointLight.shadow.mapSize.width = 128;
|
||||
pointLight.shadow.mapSize.height = 128;
|
||||
pointLight.visible = false;
|
||||
torchGroup.add(pointLight);
|
||||
|
||||
// --- Particle System for Fire ---
|
||||
@ -82,6 +83,7 @@ export class StageTorches extends SceneFeature {
|
||||
}
|
||||
particles.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
|
||||
const particleSystem = new THREE.Points(particles, particleMaterial);
|
||||
particleSystem.visible = false;
|
||||
torchGroup.add(particleSystem);
|
||||
|
||||
return { group: torchGroup, light: pointLight, particles: particleSystem, particleData: particleData };
|
||||
@ -102,9 +104,25 @@ export class StageTorches extends SceneFeature {
|
||||
}
|
||||
|
||||
update(deltaTime) {
|
||||
if (!state.partyStarted) return;
|
||||
const enabled = state.config.torchesEnabled;
|
||||
this.torches.forEach(torch => {
|
||||
if (torch.group.visible !== enabled) torch.group.visible = enabled;
|
||||
});
|
||||
|
||||
if (!enabled) return;
|
||||
|
||||
if (!state.partyStarted) {
|
||||
this.torches.forEach(torch => {
|
||||
if (torch.light.visible) torch.light.visible = false;
|
||||
if (torch.particles.visible) torch.particles.visible = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.torches.forEach(torch => {
|
||||
if (!torch.light.visible) torch.light.visible = true;
|
||||
if (!torch.particles.visible) torch.particles.visible = true;
|
||||
|
||||
let measurePulse = 0;
|
||||
if (state.music) {
|
||||
measurePulse = state.music.measurePulse * 2.0; // Make flames jump higher
|
||||
@ -156,8 +174,14 @@ export class StageTorches extends SceneFeature {
|
||||
|
||||
onPartyStart() {
|
||||
this.torches.forEach(torch => {
|
||||
if (state.config.torchesEnabled) {
|
||||
torch.group.visible = true;
|
||||
torch.light.visible = true;
|
||||
torch.particles.visible = true;
|
||||
this.resetParticles(torch);
|
||||
} else {
|
||||
torch.group.visible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user