projectile system
This commit is contained in:
parent
918b4884b2
commit
ad4a2cf393
17 changed files with 400 additions and 23 deletions
|
|
@ -2,6 +2,8 @@
|
|||
#![allow(clippy::type_complexity)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
pub mod projectiles;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use avian3d::prelude::*;
|
||||
|
|
@ -13,7 +15,8 @@ pub struct CombatPlugin;
|
|||
|
||||
impl Plugin for CombatPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_observer(on_attack)
|
||||
app.add_plugins(projectiles::ProjectilePlugin)
|
||||
.add_observer(on_attack)
|
||||
.add_observer(on_die)
|
||||
.add_systems(
|
||||
FixedUpdate,
|
||||
|
|
@ -23,7 +26,7 @@ impl Plugin for CombatPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PhysicsLayer, Default, Component, Clone, Debug, PartialEq, Eq, Reflect)]
|
||||
#[derive(PhysicsLayer, Default, Component, Clone, Copy, Debug, PartialEq, Eq, Reflect)]
|
||||
pub enum Team {
|
||||
#[default]
|
||||
Core,
|
||||
|
|
@ -37,6 +40,12 @@ impl Team {
|
|||
Team::Inhabitant => CollisionLayers::new(Team::Inhabitant, LayerMask::ALL),
|
||||
}
|
||||
}
|
||||
pub fn enemy_layers(&self) -> LayerMask {
|
||||
match self {
|
||||
Team::Core => Team::Inhabitant.into(),
|
||||
Team::Inhabitant => Team::Core.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Event, Debug, Default)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue