add souls and bones + tower cost and enemy drops
This commit is contained in:
parent
bc02db7b26
commit
138a524abd
18 changed files with 151 additions and 14 deletions
|
|
@ -9,6 +9,7 @@ avian3d = { workspace = true }
|
|||
|
||||
state = { path = "../state" }
|
||||
physics = { path = "../physics"}
|
||||
resources = { path = "../resources" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use std::time::Duration;
|
|||
|
||||
use avian3d::prelude::*;
|
||||
use bevy::prelude::*;
|
||||
use resources::{Drops, Resources};
|
||||
use state::GameSystemSet;
|
||||
|
||||
pub struct CombatPlugin;
|
||||
|
|
@ -190,7 +191,17 @@ fn on_attack(
|
|||
}
|
||||
}
|
||||
|
||||
fn on_die(trigger: Trigger<Died>, names: Query<&Name>, mut commands: Commands) {
|
||||
fn on_die(
|
||||
trigger: Trigger<Died>,
|
||||
names: Query<&Name>,
|
||||
drops: Query<&Drops>,
|
||||
mut resources: ResMut<Resources>,
|
||||
mut commands: Commands,
|
||||
) {
|
||||
if let Ok(drop) = drops.get(trigger.target()) {
|
||||
resources.souls += drop.souls;
|
||||
info!("you now have {} souls", resources.souls);
|
||||
}
|
||||
if let Ok(mut ec) = commands.get_entity(trigger.target()) {
|
||||
info!(
|
||||
"{:?} killed {:?}!",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue