add soul spot resource deposit and fix core placement bug
This commit is contained in:
parent
52da1f8acb
commit
68f4b0d8a0
13 changed files with 171 additions and 27 deletions
|
|
@ -33,7 +33,7 @@ impl Plugin for UiIngamePlugin {
|
|||
place_core
|
||||
.run_if(in_state(GameUIState::Default).and(in_state(CoreState::Unplaced))),
|
||||
side_panel
|
||||
.run_if(in_state(GameUIState::Default).and(in_state(CoreState::Placed))),
|
||||
.run_if(in_state(GameUIState::Default).and(not(in_state(CoreState::Dead)))),
|
||||
game_over.run_if(in_state(GameState::GameOver)),
|
||||
plan_ui.run_if(in_state(GameUIState::Default).and(in_state(Phase::Plan))),
|
||||
execute_ui.run_if(in_state(GameUIState::Default).and(in_state(Phase::Execute))),
|
||||
|
|
@ -185,6 +185,7 @@ fn transition_ui(
|
|||
|
||||
fn side_panel(
|
||||
mut contexts: EguiContexts,
|
||||
core_state: Res<State<CoreState>>,
|
||||
mut commands: Commands,
|
||||
mut resources: ResMut<Resources>,
|
||||
mut available_workers: ResMut<AvailableWorkers>,
|
||||
|
|
@ -276,6 +277,13 @@ fn side_panel(
|
|||
ui.label(
|
||||
RichText::new(format!("Bones: {}", deposit.bounty.bones)).size(FONT_SIZE),
|
||||
);
|
||||
ui.label(
|
||||
RichText::new(format!(
|
||||
"Produces every {:.1} seconds.",
|
||||
deposit.harvest_time.as_secs_f32()
|
||||
))
|
||||
.size(FONT_SIZE),
|
||||
);
|
||||
}
|
||||
|
||||
//upgrades
|
||||
|
|
@ -327,6 +335,10 @@ fn side_panel(
|
|||
return;
|
||||
}
|
||||
// --- view when nothing's selected ---
|
||||
if *core_state.get() == CoreState::Unplaced {
|
||||
// don't allow placing tower's while core is not placed
|
||||
return;
|
||||
}
|
||||
ui.label(RichText::new(format!("Souls: {}", resources.souls)).size(LARGE_FONT_SIZE));
|
||||
ui.label(RichText::new(format!("Bones: {}", resources.bones)).size(LARGE_FONT_SIZE));
|
||||
ui.heading(RichText::new("Buildings").underline());
|
||||
|
|
@ -350,6 +362,7 @@ fn side_panel(
|
|||
fn place_core(
|
||||
mut contexts: EguiContexts,
|
||||
mut selected_preview_writer: EventWriter<SelectBuildingPreview>,
|
||||
mut selected_writer: EventWriter<SelectEntity>,
|
||||
core_preview: Single<Entity, With<CorePreview>>,
|
||||
) {
|
||||
let ctx = contexts.ctx_mut().unwrap();
|
||||
|
|
@ -363,6 +376,7 @@ fn place_core(
|
|||
.button(RichText::new("COLONIZE").size(MEGA_FONT_SIZE))
|
||||
.clicked()
|
||||
{
|
||||
selected_writer.write(SelectEntity(None));
|
||||
selected_preview_writer.write(SelectBuildingPreview(Some(*core_preview)));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue