src/core/SpawningManager.js
/**
	* Inits the collectable health packs.
	*
	* @return {SpawningManager} A reference to this spawning manager.
	*/
Inits the collectable health packs.
@return {SpawningManager} A reference to this spawning manager.
Inits the collectable health packs . @return { SpawningManager } A reference to this spawning manager .
initHealthPacks() {
		const world = this.world;
		const assetManager = world.assetManager;
		for ( let spawningPoint of this.healthPackSpawningPoints ) {
			const healthPack = new HealthPack();
			healthPack.position.copy( spawningPoint );
			const renderComponent = world.assetManager.models.get( 'healthPack' ).clone();
			renderComponent.position.copy( healthPack.position );
			healthPack.setRenderComponent( renderComponent, sync );
			this.healthPacks.push( healthPack );
			world.add( healthPack );
			healthPack.currentRegion = world.navMesh.getRegionForPoint( healthPack.position, 1 );
			const audio = assetManager.cloneAudio( assetManager.audios.get( 'health' ) );
			healthPack.audio = audio;
			renderComponent.add( audio );
			this.createTrigger( healthPack, CONFIG.HEALTH_PACK.RADIUS );
		}
		return this;
	}
initHealthPacks ( ) { const world = this . world ; const assetManager = world . assetManager ; for ( let spawningPoint of this . healthPackSpawningPoints ) { const healthPack = new HealthPack ( ) ; healthPack . position . copy ( spawningPoint ) ; const renderComponent = world . assetManager . models . get ( 'healthPack' ) . clone ( ) ; renderComponent . position . copy ( healthPack . position ) ; healthPack . setRenderComponent ( renderComponent , sync ) ; this . healthPacks . push ( healthPack ) ; world . add ( healthPack ) ; healthPack . currentRegion = world . navMesh . getRegionForPoint ( healthPack . position , 1 ) ; const audio = assetManager . cloneAudio ( assetManager . audios . get ( 'health' ) ) ; healthPack . audio = audio ; renderComponent . add ( audio ) ; this . createTrigger ( healthPack , CONFIG . HEALTH_PACK . RADIUS ) ; } return this ; }
Inits the collectable health packs.
Inits the collectable health packs .
// health pack entity // navigation // audio // trigger