aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 14:56:30 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 15:12:22 +0100
commit7b6d9242e4217c8229cb546de495cd2670b97f2d (patch)
treef65be0458aa9c56501b6028444836459292bed49 /src/client.rs
parent2d21d709901c96b05d7f0169dd9d1207436c658c (diff)
feat: render buffs in client
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs25
1 files changed, 25 insertions, 0 deletions
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<ClientId>,
cooldowns: Query<(&PlayerId, &Cooldown)>,