Fire sound

This commit is contained in:
Andy Kernel 2024-08-15 12:26:40 +02:00 committed by solcloud
parent 561118c8b3
commit 9ba2ef917b
6 changed files with 27 additions and 9 deletions

View File

@ -45,7 +45,7 @@ final class GrillEvent extends Event implements ForOneRoundMax
private readonly int $flameRadius,
private readonly int $flameHeight,
private readonly Graph $graph,
Point $start,
private readonly Point $start,
)
{
$flameArea = ($this->flameRadius * 2 + 1) ** 2;
@ -163,4 +163,13 @@ final class GrillEvent extends Event implements ForOneRoundMax
$this->playerTickHits[$playerId] = $tickId;
}
public function serialize(): array
{
return [
'position' => $this->start->toArray(),
'maxTime' => $this->item->getMaxTimeMs(),
'maxFlames' => $this->maxFlameCount,
];
}
}

View File

@ -109,7 +109,7 @@ export class EventProcessor {
}
eventsCallback[EventList.GrillEvent] = function (data) {
// todo play grill song
game.grillStart(data.position, data.maxTime, data.maxFlames)
}
this.#callbacks = eventsCallback

View File

@ -313,6 +313,10 @@ export class Game {
delete this.#throwables[id]
}
grillStart(position, maxTimeMs, maxFlamesCount) {
this.#world.playSound('338301_4811732-lq.mp3', position, false)
}
spawnFlame(point, size, height, fireId, flameId) {
if (this.#flammable[fireId] === undefined) {
this.#flammable[fireId] = {}

View File

@ -133,11 +133,8 @@ export class SoundRepository {
return null
}
if (type === SoundType.FLAME_SPAWN) {
return null // todo
}
if (type === SoundType.FLAME_EXTINGUISH) {
return null // todo
if (type === SoundType.FLAME_SPAWN || type === SoundType.FLAME_EXTINGUISH) {
return null
}
if (type === SoundType.GRENADE_AIR) {
return '575509__awildfilli__granada_tiro.wav'

View File

@ -10,6 +10,7 @@ export class World {
#modelRepository
#decals = []
#flames = []
#flameGeometry = null
volume = 30
constructor() {
@ -174,9 +175,16 @@ export class World {
}
spawnFlame(size, height) {
if (this.#flameGeometry === null){
this.#flameGeometry = []
this.#flameGeometry.push(new THREE.ConeGeometry(size, height, 4))
this.#flameGeometry.push(new THREE.ConeGeometry(size, height, 5))
this.#flameGeometry.push(new THREE.ConeGeometry(size, height, 6))
this.#flameGeometry.push(new THREE.ConeGeometry(size, height, 7))
}
let mesh = new THREE.Mesh(
new THREE.ConeGeometry(size, height, randomInt(4, 7)),
new THREE.MeshStandardMaterial({color: new THREE.Color(`hsl(53, 100%, ${Math.random() * 70 + 20}%, 1)`)}),
this.#flameGeometry[randomInt(0, this.#flameGeometry.length - 1)],
new THREE.MeshBasicMaterial({color: new THREE.Color(`hsl(53, 100%, ${Math.random() * 70 + 20}%, 1)`)}),
)
mesh.castShadow = false

Binary file not shown.