From 87c8f508d86477e24b448e698f9aec13f71a85fd Mon Sep 17 00:00:00 2001 From: CoCo_Sol007 Date: Sat, 9 Mar 2024 14:01:27 +0100 Subject: [PATCH] change name --- crates/border-wars/src/main.rs | 4 ++-- crates/border-wars/src/map/click_tile.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/border-wars/src/main.rs b/crates/border-wars/src/main.rs index 400bff7..cc2c72e 100644 --- a/crates/border-wars/src/main.rs +++ b/crates/border-wars/src/main.rs @@ -2,7 +2,7 @@ use bevy::prelude::*; use border_wars::camera::CameraPlugin; -use border_wars::map::click_tile::SelectorPlugin; +use border_wars::map::click_tile::TilesClickable; use border_wars::map::renderer::RendererPlugin; use border_wars::scenes::ScenesPlugin; @@ -12,6 +12,6 @@ fn main() { .add_plugins(ScenesPlugin) .add_plugins(RendererPlugin) .add_plugins(CameraPlugin) - .add_plugins(SelectorPlugin) + .add_plugins(TilesClickable) .run(); } diff --git a/crates/border-wars/src/map/click_tile.rs b/crates/border-wars/src/map/click_tile.rs index 2ed2f95..a29b0ce 100644 --- a/crates/border-wars/src/map/click_tile.rs +++ b/crates/border-wars/src/map/click_tile.rs @@ -22,9 +22,9 @@ struct ClickOnTheWorld(Vec2); pub struct ZoneNotClickable; /// A plugin that handles the selection of tiles. -pub struct SelectorPlugin; +pub struct TilesClickable; -impl Plugin for SelectorPlugin { +impl Plugin for TilesClickable { fn build(&self, app: &mut App) { app.add_systems(PreUpdate, mouse_handler) .add_systems(PreUpdate, select_closest_tile) @@ -77,7 +77,7 @@ fn mouse_handler( fn select_closest_tile( tiles: Query<(Entity, &Transform, &Tile)>, mut click_event_reader: EventReader, - mut select_tile_event_writer: EventWriter, + mut clicked_tile_event_writer: EventWriter, ) { for click_event in click_event_reader.read() { // The closest tile and its distance to the cursor. @@ -99,7 +99,7 @@ fn select_closest_tile( } } if let Some(tile_entity) = closest_entity { - select_tile_event_writer.send(TileJustClicked(tile_entity.index())); + clicked_tile_event_writer.send(TileJustClicked(tile_entity.index())); } } }