head database for aim and ai
This commit is contained in:
@@ -4,6 +4,7 @@ mod target_ui;
|
||||
use crate::{
|
||||
GameState,
|
||||
head::ActiveHead,
|
||||
head_asset::HeadsDatabase,
|
||||
physics_layers::GameLayer,
|
||||
player::{Player, PlayerBodyMesh},
|
||||
tb_entities::EnemySpawn,
|
||||
@@ -53,15 +54,15 @@ fn add_aim(mut commands: Commands, query: Query<Entity, Added<ActiveHead>>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn head_change(mut query: Query<(&ActiveHead, &mut AimState), Changed<ActiveHead>>) {
|
||||
fn head_change(
|
||||
mut query: Query<(&ActiveHead, &mut AimState), Changed<ActiveHead>>,
|
||||
heads_db: Res<HeadsDatabase>,
|
||||
) {
|
||||
for (head, mut state) in query.iter_mut() {
|
||||
// info!("head changed: {}", head.0);
|
||||
// state.max_angle = if head.0 == 0 { PI / 8. } else { PI / 2. }
|
||||
state.range = match head.0 {
|
||||
0 => 80.,
|
||||
3 => 60.,
|
||||
_ => 40.,
|
||||
};
|
||||
let stats = heads_db.head_stats(head.0);
|
||||
state.range = stats.range;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user