diff options
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs index 8da77dc..7e0cebf 100644 --- a/src/client.rs +++ b/src/client.rs @@ -2,6 +2,7 @@ use crate::client::network::*; use crate::protocol::*; use crate::shared::ability::*; use crate::shared::activation::*; +use crate::shared::area_of_effect::*; use crate::shared::champion::*; use crate::shared::cooldown::*; use crate::shared::health::*; @@ -76,6 +77,7 @@ impl Plugin for ClientPlugin { ( render_players.after(move_players), render_projectiles.after(move_projectiles), + render_area_of_effects, render_health, ), ) @@ -226,6 +228,31 @@ fn render_projectiles( } } +fn render_area_of_effects( + mut commands: Commands, + mut materials: ResMut<Assets<ColorMaterial>>, + mut meshes: ResMut<Assets<Mesh>>, + area_of_effects: Query<(Entity, &AreaOfEffect), Added<AreaOfEffect>>, +) { + for (entity, area_of_effect) in area_of_effects.iter() { + if area_of_effect.duration.is_none() { + continue; + } + commands.entity(entity).insert(MaterialMesh2dBundle { + mesh: Mesh2dHandle(meshes.add(Circle { + radius: area_of_effect.radius, + })), + material: materials.add(Color::BLACK), + transform: Transform::from_xyz( + area_of_effect.position.x, + area_of_effect.position.y, + 1., + ), + ..Default::default() + }); + } +} + fn move_projectiles(mut projectiles: Query<(&mut Transform, &Projectile), Changed<Projectile>>) { for (mut transform, projectile) in projectiles.iter_mut() { let Some(position) = (match projectile.type_ { |