fix: Default gravity parameters
This commit is contained in:
parent
b08d07b2ac
commit
12eb4b59b9
2 changed files with 15 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ use bevy::prelude::*;
|
|||
use crate::grid::{Grid,GridElement};
|
||||
use crate::MAX_FLUID_AMOUNT;
|
||||
|
||||
const FLUID_FULLNES_STAGES: usize = 7;
|
||||
const FLUID_FULLNES_STAGES: usize = 15;
|
||||
|
||||
pub struct GameViewPlugin;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ impl Plugin for UIPlugin {
|
|||
app.add_plugins(FeathersPlugins)
|
||||
.insert_resource(UiTheme(create_dark_theme()))
|
||||
.add_systems(Startup, ui.spawn())
|
||||
.add_systems(Update, count_water_amount);
|
||||
.add_systems(Update, count_water_amount)
|
||||
.add_systems(PostStartup, |mut commands: Commands, query: Query<Entity>| query.iter().for_each(|entity| commands.trigger(ReadyPlaceholder(entity)) ));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,6 +28,9 @@ struct SpeedLabel;
|
|||
#[derive(Component, Clone, Default)]
|
||||
struct ToolLabel;
|
||||
|
||||
#[derive(EntityEvent,Clone)]
|
||||
struct ReadyPlaceholder(Entity);
|
||||
|
||||
const MAX_FREQUENCY: u32 = 512;
|
||||
const MIN_FREQUENCY: u32 = 1;
|
||||
|
||||
|
|
@ -245,18 +249,27 @@ fn gravity_control() -> impl Scene {
|
|||
}
|
||||
on(|change: On<ValueChange<f32>>, mut gravity: ResMut<SimulationOptions>| {
|
||||
gravity.gravity.x = change.value;
|
||||
})
|
||||
on(|change: On<ReadyPlaceholder>, mut commands: Commands, gravity: Res<SimulationOptions>| {
|
||||
commands.trigger(UpdateNumberInput { entity: change.0, value: NumberInputValue::F32(gravity.gravity.x) });
|
||||
}),
|
||||
@FeathersNumberInput {
|
||||
@label_text: "Y"
|
||||
}
|
||||
on(|change: On<ValueChange<f32>>, mut gravity: ResMut<SimulationOptions>| {
|
||||
gravity.gravity.y = change.value;
|
||||
})
|
||||
on(|change: On<ReadyPlaceholder>, mut commands: Commands, gravity: Res<SimulationOptions>| {
|
||||
commands.trigger(UpdateNumberInput { entity: change.0, value: NumberInputValue::F32(gravity.gravity.y) });
|
||||
}),
|
||||
@FeathersNumberInput {
|
||||
@label_text: "Z"
|
||||
}
|
||||
on(|change: On<ValueChange<f32>>, mut gravity: ResMut<SimulationOptions>| {
|
||||
gravity.gravity.z = change.value;
|
||||
})
|
||||
on(|change: On<ReadyPlaceholder>, mut commands: Commands, gravity: Res<SimulationOptions>| {
|
||||
commands.trigger(UpdateNumberInput { entity: change.0, value: NumberInputValue::F32(gravity.gravity.z) });
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue