Drop score on death
This commit is contained in:
parent
70a12b984c
commit
adc5198255
1 changed files with 6 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue