Compare commits

...

1 commit

Author SHA1 Message Date
91d24e3bf4 comment unused constant 2022-08-24 16:04:06 +08:00
2 changed files with 5 additions and 2 deletions

View file

@ -270,7 +270,7 @@ fn keyboard_input_system(
fn character_particle_effect_system( fn character_particle_effect_system(
mut characters: Query<(&CharacterId, &Transform, &CharacterColor)>, mut characters: Query<(&CharacterId, &Transform, &CharacterColor)>,
mut particle_effect: ResMut<crate::particle_effect::ParticleEffectResource>, mut particle_effect: ResMut<crate::particle_effect::ParticleEffectResource>,
mut level_query: Query<(&SelectedCharacterId)>, mut level_query: Query<&SelectedCharacterId>,
) { ) {
if let Ok(selected_character_id) = level_query.get_single_mut() { if let Ok(selected_character_id) = level_query.get_single_mut() {
if let Some(selected_character_id) = &selected_character_id.0 { if let Some(selected_character_id) = &selected_character_id.0 {
@ -308,6 +308,7 @@ fn move_camera(
mut camera_query: Query<(&Camera, &mut Transform, &GlobalTransform)>, mut camera_query: Query<(&Camera, &mut Transform, &GlobalTransform)>,
characters: Query<(&CharacterId, &Transform), Without<Camera>>, characters: Query<(&CharacterId, &Transform), Without<Camera>>,
level_query: Query<&SelectedCharacterId>, level_query: Query<&SelectedCharacterId>,
time: Res<Time>,
) { ) {
const MARGIN: f32 = 128.0; const MARGIN: f32 = 128.0;
@ -324,6 +325,8 @@ fn move_camera(
.world_to_viewport(camera_global_transform, transform.translation) .world_to_viewport(camera_global_transform, transform.translation)
.unwrap(); .unwrap();
let size = camera.logical_viewport_size().unwrap(); let size = camera.logical_viewport_size().unwrap();
// force camera to be within margin
if pos.x < MARGIN { if pos.x < MARGIN {
camera_transform.translation.x += pos.x - MARGIN; camera_transform.translation.x += pos.x - MARGIN;
} }

View file

@ -6,7 +6,7 @@ pub const POOL_COUNT: usize = 100;
pub const MIN_VELOCITY: f32 = 10.0; pub const MIN_VELOCITY: f32 = 10.0;
pub const MAX_VELOCITY: f32 = 100.0; pub const MAX_VELOCITY: f32 = 100.0;
pub const VELOCITY_SCALE: f32 = 0.1; // pub const VELOCITY_SCALE: f32 = 0.1;
pub const PARTICLE_EFFECT_RADIUS: f32 = 70.0; pub const PARTICLE_EFFECT_RADIUS: f32 = 70.0;
pub struct ParticleEffectPlugin; pub struct ParticleEffectPlugin;