properly reset generic asteroids on death
This commit is contained in:
parent
8c3eb72994
commit
f1a7781fa2
|
@ -428,6 +428,7 @@ fn handle_player_death(
|
|||
q_noscenes: Query<Entity, (With<world::DespawnOnPlayerDeath>, Without<SceneInstance>)>,
|
||||
ew_spawn: EventWriter<commands::SpawnEvent>,
|
||||
mut scene_spawner: ResMut<SceneSpawner>,
|
||||
mut active_asteroids: ResMut<world::ActiveAsteroids>,
|
||||
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||
mut ew_effect: EventWriter<effects::SpawnEffectEvent>,
|
||||
mut log: ResMut<hud::Log>,
|
||||
|
@ -438,6 +439,7 @@ fn handle_player_death(
|
|||
return;
|
||||
}
|
||||
settings.reset_player_settings();
|
||||
active_asteroids.0.clear();
|
||||
for entity in &q_noscenes {
|
||||
cmd.entity(entity).despawn();
|
||||
}
|
||||
|
|
|
@ -78,14 +78,14 @@ impl Plugin for WorldPlugin {
|
|||
|
||||
#[derive(Resource)] struct AsteroidUpdateTimer(Timer);
|
||||
#[derive(Resource)] struct AsteroidDatabase(Vec<AsteroidData>);
|
||||
#[derive(Resource)] struct ActiveAsteroids(HashMap<I64Vec3, AsteroidData>);
|
||||
#[derive(Resource)] pub struct ActiveAsteroids(pub HashMap<I64Vec3, AsteroidData>);
|
||||
#[derive(Resource)] struct AsteroidModel1(Handle<Scene>);
|
||||
#[derive(Resource)] struct AsteroidModel2(Handle<Scene>);
|
||||
|
||||
#[derive(Component)] struct Asteroid;
|
||||
#[derive(Component)] pub struct DespawnOnPlayerDeath;
|
||||
|
||||
struct AsteroidData {
|
||||
pub struct AsteroidData {
|
||||
entity: Entity,
|
||||
//viewdistance: f64,
|
||||
}
|
||||
|
@ -342,6 +342,7 @@ fn spawn_despawn_asteroids(
|
|||
Rotation::from(Quat::from_rotation_y(-PI / 3.)),
|
||||
Position::new(pos),
|
||||
Asteroid,
|
||||
DespawnOnPlayerDeath,
|
||||
));
|
||||
let model = match class {
|
||||
0 => asteroid1_handle.0.clone(),
|
||||
|
|
Loading…
Reference in a new issue