add sound effects
This commit is contained in:
parent
86f2345667
commit
587b902e79
39 changed files with 234 additions and 40 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use bevy::prelude::*;
|
||||
use building::{BuildingInfo, BuildingPreview, Core, PREVIEW_ALPHA, PopulatePlacedBuilding};
|
||||
use combat::{Defense, Died, Health, Range};
|
||||
use combat::{DeathAudio, Defense, Died, Health, Range};
|
||||
use resources::{AvailableWorkers, Quantity};
|
||||
use state::{CoreState, GameState};
|
||||
use ui_range_indicator::CustomRangeIndicator;
|
||||
|
|
@ -23,6 +23,7 @@ struct CoreResources {
|
|||
mesh: Handle<Mesh>,
|
||||
material: Handle<StandardMaterial>,
|
||||
info_entity: Entity,
|
||||
death_sound: Handle<AudioSource>,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
|
|
@ -34,6 +35,7 @@ fn register(
|
|||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
assets: Res<AssetServer>,
|
||||
) {
|
||||
let mesh = meshes.add(Cuboid::from_length(2.0));
|
||||
let base_material = StandardMaterial {
|
||||
|
|
@ -65,6 +67,7 @@ fn register(
|
|||
preview,
|
||||
size: SIZE,
|
||||
unlocked: false,
|
||||
place_sound: assets.load("sounds/megathump.ogg"),
|
||||
},
|
||||
UpgradeTree { upgrades },
|
||||
Name::new("Core"),
|
||||
|
|
@ -76,6 +79,7 @@ fn register(
|
|||
mesh: mesh,
|
||||
material: material,
|
||||
info_entity: info,
|
||||
death_sound: assets.load("sounds/megathump2.ogg"),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -157,6 +161,7 @@ fn populate(
|
|||
Core,
|
||||
Mesh3d(res.mesh.clone()),
|
||||
MeshMaterial3d(res.material.clone()),
|
||||
DeathAudio(res.death_sound.clone()),
|
||||
CustomRangeIndicator::new(materials.add(StandardMaterial {
|
||||
alpha_mode: AlphaMode::Blend,
|
||||
base_color: Color::srgba(0.6, 0.2, 0.2, 0.4),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue