Drop score on death

This commit is contained in:
Rendo 2025-11-18 00:27:00 +05:00
commit adc5198255

View file

@ -1,6 +1,6 @@
use bevy::prelude::*;
use crate::{damagable::DamageableKilled, ships::Factions};
use crate::{GameState, damagable::DamageableKilled, ships::Factions};
const ENEMY_REWARD: u64 = 10;
@ -18,10 +18,15 @@ impl Plugin for ScorePlugin {
score: 0,
max_score: 0,
})
.add_systems(OnEnter(GameState::Game), drop_score)
.add_observer(on_something_died);
}
}
pub fn drop_score(mut score: ResMut<Score>) {
score.score = 0;
}
pub fn on_something_died(killed: On<DamageableKilled>, mut score: ResMut<Score>) {
let Some(faction) = killed.killed_faction else {
return;