From 7b6d9242e4217c8229cb546de495cd2670b97f2d Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 19 Mar 2024 14:56:30 +0100 Subject: feat: render buffs in client --- src/client.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/client.rs') diff --git a/src/client.rs b/src/client.rs index 7e0cebf..91d8c7f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -3,6 +3,7 @@ use crate::protocol::*; use crate::shared::ability::*; use crate::shared::activation::*; use crate::shared::area_of_effect::*; +use crate::shared::buffs::*; use crate::shared::champion::*; use crate::shared::cooldown::*; use crate::shared::health::*; @@ -79,6 +80,7 @@ impl Plugin for ClientPlugin { render_projectiles.after(move_projectiles), render_area_of_effects, render_health, + render_buffs, ), ) .add_systems( @@ -559,6 +561,29 @@ fn render_health(players: Query<(&Health, &PlayerPosition, &EffectiveStats)>, mu } } +fn render_buffs(players: Query<(&Buffs, &PlayerPosition)>, mut gizmos: Gizmos) { + for (buffs, position) in players.iter() { + let mut start = + position.0 + Vec2::new(-PLAYER_RADIUS + 1., PLAYER_RADIUS + HEALTH_OFFSET + 2.); + if buffs.haste.is_some() { + gizmos.rect_2d(start, 0., Vec2::new(2., 2.), Color::RED); + start = start + Vec2::new(3., 0.); + } + if buffs.shield.is_some() { + gizmos.rect_2d(start, 0., Vec2::new(2., 2.), Color::GRAY); + start = start + Vec2::new(3., 0.); + } + if buffs.slow.is_some() { + gizmos.rect_2d(start, 0., Vec2::new(2., 2.), Color::BLUE); + start = start + Vec2::new(3., 0.); + } + if buffs.speed.is_some() { + gizmos.rect_2d(start, 0., Vec2::new(2., 2.), Color::GREEN); + //start = start + Vec2::new(3., 0.); + } + } +} + fn hotbar_cooldown( client_id: Res, cooldowns: Query<(&PlayerId, &Cooldown)>, -- cgit v1.2.3