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