-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
170 additions
and
17 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
mod ui; | ||
|
||
use bevy::{app::Plugin as BevyPlugin, prelude::*}; | ||
use bevy_kira_audio::{AudioChannel, AudioControl}; | ||
use iyes_loopless::prelude::*; | ||
|
||
use crate::{resources::prelude::*, ui::OverlayMarker}; | ||
|
||
pub struct Plugin; | ||
|
||
impl BevyPlugin for Plugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_enter_system(GameState::Limit, self::ui::spawn) | ||
.add_system_set( | ||
ConditionSet::new() | ||
.run_in_state(GameState::Limit) | ||
.with_system(handle_input.run_on_event::<ActionInputEvent>()) | ||
.with_system(play_sfx.run_on_event::<ActionInputEvent>()) | ||
.into(), | ||
) | ||
.add_exit_system(GameState::Limit, cleanup::<OverlayMarker>); | ||
} | ||
} | ||
|
||
fn handle_input( | ||
mut game_state_event_writer: EventWriter<SceneTransitionEvent>, | ||
mut action_event_reader: EventReader<ActionInputEvent>, | ||
) { | ||
for action_event in action_event_reader.iter() { | ||
if matches!(action_event.value, ActionInput::Select) { | ||
game_state_event_writer.send(SceneTransitionEvent::selection(SelectionKind::Custom)); | ||
} | ||
} | ||
} | ||
|
||
fn play_sfx( | ||
mut action_event_reader: EventReader<ActionInputEvent>, | ||
sounds: Res<Sounds>, | ||
sfx: Res<AudioChannel<Sfx>>, | ||
) { | ||
for action_event in action_event_reader.iter() { | ||
if matches!(action_event.value, ActionInput::Select) { | ||
sfx.play(sounds.sfx_push_box.clone()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::{ | ||
resources::prelude::*, | ||
ui::{Container, GameText, Overlay, SimpleText}, | ||
}; | ||
|
||
pub fn spawn(mut commands: Commands, fonts: Res<Fonts>) { | ||
let font = fonts.primary(); | ||
|
||
let overlay = Overlay::default(); | ||
let mut center = Container::height(140.0); | ||
|
||
let mut reached_limit = | ||
SimpleText::medium("You reached the limit\nfor the custom levels", font); | ||
let press_button = SimpleText::small( | ||
"Press SPACE to continue to the custom level selection", | ||
font, | ||
); | ||
|
||
center.justify_between(); | ||
reached_limit.primary(); | ||
|
||
overlay.spawn(&mut commands, |parent| { | ||
center.spawn(parent, |parent| { | ||
reached_limit.spawn(parent); | ||
press_button.spawn(parent); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters