generated from tipragot/rust
ajout d'un event de fin de map
This commit is contained in:
parent
32f09423cb
commit
e3c2bc1ac9
|
@ -28,9 +28,14 @@ pub struct MapGenerationEvent {
|
|||
pub radius: usize,
|
||||
}
|
||||
|
||||
/// An event send when the map is generated.
|
||||
#[derive(Event)]
|
||||
pub struct EndMapGenerationEvent;
|
||||
|
||||
/// Spawns the tiles if the event is received.
|
||||
fn generate_map(
|
||||
mut event: EventReader<MapGenerationEvent>,
|
||||
mut end_map_event: EventWriter<EndMapGenerationEvent>,
|
||||
mut commands: Commands,
|
||||
mut noise: Local<Option<Perlin>>,
|
||||
mut map_iterator: Local<Option<HexSpiral<isize>>>,
|
||||
|
@ -47,6 +52,7 @@ fn generate_map(
|
|||
|
||||
commands.spawn((get_type_tile(pixel_position, perlin), position));
|
||||
} else {
|
||||
end_map_event.send(EndMapGenerationEvent);
|
||||
*noise = None;
|
||||
*map_iterator = None;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue