|
|
|
|
@ -39,10 +39,10 @@ fn main() {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
.add_systems(
|
|
|
|
|
OnEnter(DebuggingState::On), toggle_art
|
|
|
|
|
OnEnter(DebuggingState::On), toggle_visuals
|
|
|
|
|
)
|
|
|
|
|
.add_systems(
|
|
|
|
|
OnExit(DebuggingState::On), toggle_art
|
|
|
|
|
OnExit(DebuggingState::On), toggle_visuals
|
|
|
|
|
)
|
|
|
|
|
.add_systems(
|
|
|
|
|
Update,
|
|
|
|
|
@ -88,7 +88,6 @@ fn main() {
|
|
|
|
|
damage_over_time.run_if(on_timer(Duration::from_secs(5))),
|
|
|
|
|
check_level_goal.run_if(resource_changed::<Score>),
|
|
|
|
|
check_level_fail.run_if(any_component_removed::<ShapeBlock>),
|
|
|
|
|
toggle_art.run_if(any_component_added::<Art>),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// UI systems
|
|
|
|
|
@ -397,30 +396,37 @@ fn init_tetris(
|
|
|
|
|
},
|
|
|
|
|
material_o: materials.add(ColorMaterial {
|
|
|
|
|
color: YELLOW.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_t: materials.add(ColorMaterial {
|
|
|
|
|
color: PURPLE.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_l: materials.add(ColorMaterial {
|
|
|
|
|
color: ORANGE.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_j: materials.add(ColorMaterial {
|
|
|
|
|
color: BLUE.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_s: materials.add(ColorMaterial {
|
|
|
|
|
color: LIME.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_z: materials.add(ColorMaterial {
|
|
|
|
|
color: RED.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
material_i: materials.add(ColorMaterial {
|
|
|
|
|
color: AQUA.into(),
|
|
|
|
|
texture: Some(server.load("tetris/shape_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
@ -432,6 +438,7 @@ fn init_tetris(
|
|
|
|
|
Mesh2d(mesh.clone()),
|
|
|
|
|
MeshMaterial2d(materials.add(ColorMaterial {
|
|
|
|
|
color: BLACK.into(),
|
|
|
|
|
texture: Some(server.load("tetris/bg_block.png")),
|
|
|
|
|
..default()
|
|
|
|
|
})),
|
|
|
|
|
Art {
|
|
|
|
|
@ -464,6 +471,7 @@ fn init_battler(
|
|
|
|
|
{
|
|
|
|
|
let mat = materials.add(ColorMaterial {
|
|
|
|
|
color: BLUE.into(),
|
|
|
|
|
texture: Some(server.load("tetris/placeholder_protagonist.png")),
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
let mesh = meshes.add(Ellipse::new(SCALE, SCALE * 2.0));
|
|
|
|
|
@ -486,6 +494,7 @@ fn init_battler(
|
|
|
|
|
{
|
|
|
|
|
let mat = materials.add(ColorMaterial {
|
|
|
|
|
color: RED.into(),
|
|
|
|
|
texture: Some(server.load("tetris/placeholder_enemy.png")),
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
let art = Art {
|
|
|
|
|
@ -1483,9 +1492,8 @@ fn check_level_fail(
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn toggle_art(
|
|
|
|
|
fn toggle_visuals(
|
|
|
|
|
state: Res<State<DebuggingState>>,
|
|
|
|
|
// TODO: Correctness: Query for added or changed <Art> entities
|
|
|
|
|
query: Query<(&MeshMaterial2d<ColorMaterial>, &Art)>,
|
|
|
|
|
mut color_materials: ResMut<Assets<ColorMaterial>>,
|
|
|
|
|
) {
|
|
|
|
|
|