generated from 2ndbeam/bevy-template
feat: Implemented basic item drag-and-drop
- Added bundle names - Added system to update bundle names with entity name
This commit is contained in:
parent
0add3e4c20
commit
a462c64786
4 changed files with 56 additions and 18 deletions
|
|
@ -40,6 +40,12 @@ impl InputAction {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn insert_entity_name(names: Query<(Entity, &mut Name), Added<Name>>) {
|
||||
for (entity, mut name) in names {
|
||||
name.mutate(|name| name.insert_str(0, format!("{entity}: ").as_str()));
|
||||
}
|
||||
}
|
||||
|
||||
fn camera_bundle() -> impl Bundle {
|
||||
(
|
||||
Camera2d,
|
||||
|
|
@ -54,6 +60,7 @@ fn camera_bundle() -> impl Bundle {
|
|||
scale: 1.,
|
||||
..OrthographicProjection::default_2d()
|
||||
}),
|
||||
Name::new("Camera2d"),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +78,7 @@ impl Plugin for ExpeditionPlugin {
|
|||
.add_systems(Update, (
|
||||
player::handle_input,
|
||||
ui::update_window_size,
|
||||
insert_entity_name,
|
||||
))
|
||||
.add_systems(OnEnter(GameState::Inventory), inventory::ui::setup_ui_inventory)
|
||||
.add_systems(OnExit(GameState::Inventory), inventory::ui::clear_ui_inventory)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue