fix contact damage and test with impaler
This commit is contained in:
parent
9d397451c4
commit
e9790f156d
6 changed files with 16 additions and 13 deletions
|
|
@ -10,9 +10,9 @@ use bevy::{
|
|||
render::camera::Exposure,
|
||||
};
|
||||
use building_core::SpawnCore;
|
||||
use building_impaler::SpawnImpaler;
|
||||
use building_impaler::{Impaler, SpawnImpaler};
|
||||
use camera::ControlledCamera;
|
||||
use combat::{Attacked, Defense, Health};
|
||||
use combat::{Defense, Health};
|
||||
use state::AppState;
|
||||
|
||||
pub struct LevelPlugin;
|
||||
|
|
@ -64,16 +64,13 @@ fn setup(
|
|||
))
|
||||
.observe(
|
||||
|trigger: Trigger<Pointer<Click>>,
|
||||
mut query: Query<&mut LinearVelocity>,
|
||||
mut commands: Commands| {
|
||||
if let Ok(mut v) = query.get_mut(trigger.target()) {
|
||||
target: Single<&GlobalTransform, With<Impaler>>,
|
||||
mut query: Query<(&GlobalTransform, &mut LinearVelocity)>| {
|
||||
if let Ok((gtf, mut v)) = query.get_mut(trigger.target()) {
|
||||
let delta = target.translation() - gtf.translation();
|
||||
v.y += 5.0;
|
||||
v.0 += delta;
|
||||
}
|
||||
commands.entity(trigger.target()).trigger(Attacked {
|
||||
attacker: None,
|
||||
amount: 8.,
|
||||
..default()
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue