delete buildings
This commit is contained in:
parent
69bab35998
commit
23af12d258
4 changed files with 17 additions and 6 deletions
|
|
@ -150,7 +150,7 @@ fn register(
|
|||
},
|
||||
Range(10.0),
|
||||
Health::new(20.0),
|
||||
Defense::new(7.0),
|
||||
Defense::new(4.0),
|
||||
UpgradeTree { upgrades },
|
||||
Cost(Quantity {
|
||||
souls: 10,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use bevy_egui::{
|
|||
EguiContexts, EguiPrimaryContextPass,
|
||||
egui::{self, Align2, RichText},
|
||||
};
|
||||
use building::{BuildingInfo, Core};
|
||||
use building::{Building, BuildingInfo, Core};
|
||||
use building_core::CorePreview;
|
||||
use building_placement::SelectBuildingPreview;
|
||||
use combat::Range;
|
||||
|
|
@ -194,6 +194,7 @@ fn side_panel(
|
|||
upgradable: Query<&Upgradable>,
|
||||
upgrades: Query<(&Upgrade, &Name)>,
|
||||
core_query: Query<(&GlobalTransform, &Range), With<Core>>,
|
||||
non_core_building_query: Query<(), (With<Building>, Without<Core>)>,
|
||||
mut selected_resource_deposit: Query<(
|
||||
&ResourceDeposit,
|
||||
&GlobalTransform,
|
||||
|
|
@ -332,6 +333,16 @@ fn side_panel(
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
//building deletion
|
||||
if non_core_building_query.contains(selected) {
|
||||
if ui
|
||||
.button(RichText::new("Destroy").size(FONT_SIZE))
|
||||
.clicked()
|
||||
{
|
||||
commands.entity(selected).despawn();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// --- view when nothing's selected ---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue