farma updejt
This commit is contained in:
@@ -26,6 +26,8 @@ class SoundManager {
|
||||
this.beepHarvest();
|
||||
} else if (key === 'build') {
|
||||
this.beepBuild();
|
||||
} else if (key === 'dig') {
|
||||
this.beepDig();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,10 +299,28 @@ class SoundManager {
|
||||
playHarvest() { this.playSFX('harvest'); }
|
||||
playBuild() { this.playSFX('build'); }
|
||||
playPickup() { this.playSFX('pickup'); }
|
||||
playDig() { this.playSFX('dig'); } // Dodano
|
||||
playAttack() { this.beepAttack(); }
|
||||
playHit() { this.beepHit(); }
|
||||
playFootstep() { this.beepFootstep(); }
|
||||
playDeath() { this.beepDeath(); }
|
||||
playRainSound() { this.startRainNoise(); }
|
||||
stopRainSound() { this.stopRainNoise(); }
|
||||
|
||||
beepDig() {
|
||||
if (!this.scene.sound.context) return;
|
||||
const ctx = this.scene.sound.context;
|
||||
const osc = ctx.createOscillator();
|
||||
const gain = ctx.createGain();
|
||||
osc.connect(gain);
|
||||
gain.connect(ctx.destination);
|
||||
// Low "thud" for dirt interaction
|
||||
osc.frequency.setValueAtTime(80, ctx.currentTime);
|
||||
osc.frequency.exponentialRampToValueAtTime(10, ctx.currentTime + 0.15);
|
||||
osc.type = 'triangle';
|
||||
gain.gain.setValueAtTime(0.2, ctx.currentTime);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.15);
|
||||
osc.start();
|
||||
osc.stop(ctx.currentTime + 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user