pub fn despawn(&mut self, commands: &mut Commands, map_id: impl MapId) {
        let map_id: u16 = map_id.into();

        let layer_ids: Option<Vec<u16>> = if let Some((_, map)) = self
            .map_query_set
            .q1()
            .iter()
            .find(|(_, map)| map.id == map_id)
        {
            Some(map.layers.keys().map(|layer_id| *layer_id).collect())
        } else {
            None
        };

        if let Some(layer_ids) = layer_ids {
            for layer_id in layer_ids.iter() {
                self.despawn_layer(commands, map_id, *layer_id);
            }
        }

        if let Some((entity, _)) = self
            .map_query_set
            .q1()
            .iter()
            .find(|(_, map)| map.id == map_id)
        {
            commands.entity(entity).despawn_recursive();
        }
    }
/// Despawn an entire map including all layers/tiles.
Despawn an entire map including all layers/tiles.
Despawn an entire map including all layers / tiles .
pub fn despawn(&mut self, commands: &mut Commands, map_id: impl MapId) {
        let map_id: u16 = map_id.into();
        let layer_ids: Option<Vec<u16>> = if let Some((_, map)) = self
            .map_query_set
            .q1()
            .iter()
            .find(|(_, map)| map.id == map_id)
        {
            Some(map.layers.keys().map(|layer_id| *layer_id).collect())
        } else {
            None
        };
        if let Some(layer_ids) = layer_ids {
            for layer_id in layer_ids.iter() {
                self.despawn_layer(commands, map_id, *layer_id);
            }
        }
        if let Some((entity, _)) = self
            .map_query_set
            .q1()
            .iter()
            .find(|(_, map)| map.id == map_id)
        {
            commands.entity(entity).despawn_recursive();
        }
    }
pub fn despawn ( & mut self , commands : & mut Commands , map_id : impl MapId ) { let map_id : u16 = map_id . into ( ) ; let layer_ids : Option < Vec < u16 > > = if let Some ( ( _ , map ) ) = self . map_query_set . q1 ( ) . iter ( ) . find ( | ( _ , map ) | map . id == map_id ) { Some ( map . layers . keys ( ) . map ( | layer_id | * layer_id ) . collect ( ) ) } else { None } ; if let Some ( layer_ids ) = layer_ids { for layer_id in layer_ids . iter ( ) { self . despawn_layer ( commands , map_id , * layer_id ) ; } } if let Some ( ( entity , _ ) ) = self . map_query_set . q1 ( ) . iter ( ) . find ( | ( _ , map ) | map . id == map_id ) { commands . entity ( entity ) . despawn_recursive ( ) ; } }
Despawn an entire map including all layers/tiles.
Despawn an entire map including all layers / tiles .
&mut self
commands
&mut Commands
map_id
impl MapId
&mut self
commands
&mut Commands
map_id
impl MapId