generated from tipragot/rust
Add a renderer system with temp assets #60
|
@ -11,7 +11,7 @@ pub struct MapGenerationPlugin;
|
|||
|
||||
impl Plugin for MapGenerationPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_event::<MapGeneration>()
|
||||
app.add_event::<StartMapGeneration>()
|
||||
.add_event::<EndMapGeneration>()
|
||||
.add_systems(
|
||||
Update,
|
||||
|
@ -23,7 +23,7 @@ impl Plugin for MapGenerationPlugin {
|
|||
|
||||
/// An event to trigger the generation of the map.
|
||||
#[derive(Event)]
|
||||
pub struct MapGeneration {
|
||||
pub struct StartMapGeneration {
|
||||
/// The seed used to generate the map.
|
||||
pub seed: u32,
|
||||
|
||||
|
@ -37,7 +37,7 @@ pub struct EndMapGeneration;
|
|||
|
||||
/// Spawns the tiles if the event is received.
|
||||
fn generate_map(
|
||||
mut event: EventReader<MapGeneration>,
|
||||
mut event: EventReader<StartMapGeneration>,
|
||||
mut end_map_event: EventWriter<EndMapGeneration>,
|
||||
mut commands: Commands,
|
||||
mut noise: Local<Option<Perlin>>,
|
||||
|
@ -75,7 +75,7 @@ fn get_type_tile(position: (f32, f32), noise: &Perlin) -> Tile {
|
|||
fn delete_map(
|
||||
mut commands: Commands,
|
||||
query: Query<Entity, With<Tile>>,
|
||||
mut event: EventReader<MapGeneration>,
|
||||
mut event: EventReader<StartMapGeneration>,
|
||||
) {
|
||||
for _ in event.read() {
|
||||
for entity in query.iter() {
|
||||
|
|
Loading…
Reference in a new issue