Pause menu dummy (#54)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use super::{BackbackSwapEvent, Backpack, UiHeadState};
|
||||
use crate::{
|
||||
GameState, global_observer, heads::HeadsImages, loading_assets::UIAssets, sounds::PlaySound,
|
||||
GameState, HEDZ_GREEN, global_observer, heads::HeadsImages, loading_assets::UIAssets,
|
||||
sounds::PlaySound,
|
||||
};
|
||||
use bevy::{ecs::spawn::SpawnIter, prelude::*};
|
||||
|
||||
@@ -96,7 +97,7 @@ fn setup(mut commands: Commands, assets: Res<UIAssets>) {
|
||||
font_size: 34.0,
|
||||
..default()
|
||||
},
|
||||
TextColor(Color::Srgba(Srgba::rgb(0., 1., 0.))),
|
||||
TextColor(HEDZ_GREEN.into()),
|
||||
TextLayout::new_with_justify(JustifyText::Center),
|
||||
Node {
|
||||
position_type: PositionType::Absolute,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{GameState, global_observer, loading_assets::UIAssets, sounds::PlaySound};
|
||||
use crate::{GameState, HEDZ_GREEN, global_observer, loading_assets::UIAssets, sounds::PlaySound};
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Component, Reflect, Default)]
|
||||
@@ -70,7 +70,7 @@ fn setup(mut commands: Commands, assets: Res<UIAssets>) {
|
||||
font_size: 34.0,
|
||||
..default()
|
||||
},
|
||||
TextColor(Color::Srgba(Srgba::rgb(0., 1., 0.))),
|
||||
TextColor(HEDZ_GREEN.into()),
|
||||
TextLayout::new_with_justify(JustifyText::Center),
|
||||
Node {
|
||||
position_type: PositionType::Absolute,
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{
|
||||
GameState,
|
||||
abilities::{TriggerCashHeal, TriggerState},
|
||||
backpack::BackpackAction,
|
||||
control::ControllerSet,
|
||||
control::{CharacterInputEnabled, ControllerSet},
|
||||
heads::SelectActiveHead,
|
||||
};
|
||||
use bevy::{
|
||||
@@ -32,7 +32,14 @@ pub fn plugin(app: &mut App) {
|
||||
)
|
||||
.chain()
|
||||
.in_set(ControllerSet::CollectInputs)
|
||||
.run_if(in_state(GameState::Playing)),
|
||||
.run_if(
|
||||
in_state(GameState::Playing)
|
||||
.and(resource_exists_and_equals(CharacterInputEnabled::On)),
|
||||
),
|
||||
);
|
||||
app.add_systems(
|
||||
Update,
|
||||
char_controls_state.run_if(in_state(GameState::Playing)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,6 +50,17 @@ pub struct ControllerSettings {
|
||||
pub jump_force: f32,
|
||||
}
|
||||
|
||||
fn char_controls_state(
|
||||
state: Res<CharacterInputEnabled>,
|
||||
mut controls: ResMut<Controls>,
|
||||
mut control_state: ResMut<ControlState>,
|
||||
) {
|
||||
if state.is_changed() && matches!(*state, CharacterInputEnabled::Off) {
|
||||
*controls = Controls::default();
|
||||
*control_state = ControlState::default();
|
||||
}
|
||||
}
|
||||
|
||||
fn combine_controls(controls: Res<Controls>, mut combined_controls: ResMut<ControlState>) {
|
||||
let keyboard = controls.keyboard_state;
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ struct Controls {
|
||||
gamepad_state: Option<ControlState>,
|
||||
}
|
||||
|
||||
#[derive(Resource, Debug, PartialEq, Eq)]
|
||||
pub enum CharacterInputEnabled {
|
||||
On,
|
||||
Off,
|
||||
}
|
||||
|
||||
#[derive(Event)]
|
||||
pub struct ControllerSwitchEvent;
|
||||
|
||||
@@ -44,6 +50,7 @@ pub struct SelectedController(ControllerSet);
|
||||
pub fn plugin(app: &mut App) {
|
||||
app.init_resource::<SelectedController>();
|
||||
app.init_resource::<ControlState>();
|
||||
app.insert_resource(CharacterInputEnabled::On);
|
||||
|
||||
app.add_plugins(controls::plugin);
|
||||
app.add_plugins(controller_common::plugin);
|
||||
|
||||
@@ -32,6 +32,9 @@ pub mod water;
|
||||
use bevy::{core_pipeline::tonemapping::Tonemapping, prelude::*};
|
||||
use utils::{billboards, squish_animation};
|
||||
|
||||
pub const HEDZ_GREEN: Srgba = Srgba::rgb(0.0, 1.0, 0.0);
|
||||
pub const HEDZ_PURPLE: Srgba = Srgba::rgb(91. / 256., 4. / 256., 138. / 256.);
|
||||
|
||||
#[derive(Resource, Reflect, Debug)]
|
||||
#[reflect(Resource)]
|
||||
pub struct DebugVisuals {
|
||||
|
||||
Reference in New Issue
Block a user