Skip to content

Commit

Permalink
Disable SFX for dark mode, enable for others
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Dec 9, 2023
1 parent 70abbe9 commit 4c84fc1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/state/editor_screen/outline_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fn update_outline_entry_text(
*text = event.name.clone();

let count = outline.0[&entry.0];
if !upgrade.hide_count && count >= 2 {
if !upgrade.no_count && count >= 2 {
text.push_str(&format!(" ({count})"));
}
}
Expand Down
20 changes: 13 additions & 7 deletions src/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::ops::Index;
use std::ops::IndexMut;
use std::time::Duration;

use bevy::ecs::event::ManualEventReader;
use bevy::ecs::system::SystemId;
Expand Down Expand Up @@ -68,7 +67,9 @@ pub struct Upgrade {
/// If true, this upgrade won't be added to the outline and won't count as an upgrade.
pub no_outline: bool,
/// If true, this upgrade's count will not be included in the outline.
pub hide_count: bool,
pub no_count: bool,
/// If true, this upgrade will not play a sound effect upon install.
pub no_sound: bool,
/// The amount of technical debt this upgrade adds when you install it.
pub tech_debt: f64,
/// How much this upgrade contributes to the Presentation score of your submission.
Expand Down Expand Up @@ -120,7 +121,8 @@ impl Default for Upgrade {
desc: "Undefined.".to_string(),
value: 0.0,
no_outline: false,
hide_count: false,
no_count: false,
no_sound: false,
tech_debt: 0.0,
presentation_score: 0.0,
fun_score: 0.0,
Expand Down Expand Up @@ -189,6 +191,8 @@ fn process_new_installed_upgrades(
simulation.fun_score += upgrade.fun_score;
if !upgrade.no_outline {
simulation.upgrades += 1;
}
if !upgrade.no_sound {
audio.play(audio_assets.random_upgrade());
}
}
Expand Down Expand Up @@ -640,6 +644,7 @@ generate_upgrade_list!(
DarkModeDracula: Upgrade {
name: "Dark Mode (Dracula)".to_string(),
desc: "Rite of passage for all developers. Required to write code.".to_string(),
no_sound: true,
install: Some(world.register_system(|
mut commands: Commands,
root: Res<AppRoot>,
Expand All @@ -657,7 +662,7 @@ generate_upgrade_list!(

// Start background music
if let Some(instance) = audio_instances.get_mut(&music.0) {
instance.resume(AudioTween::new(Duration::from_secs_f32(0.15), AudioEasing::OutPowi(3)));
instance.resume(AudioTween::default());
} else {
error!("Background music has not loaded yet");
}
Expand All @@ -668,6 +673,7 @@ generate_upgrade_list!(
DarkModeBamboo: Upgrade {
name: "Dark Mode (Bamboo)".to_string(),
desc: "Rite of passage for all developers. Required to write code.".to_string(),
no_sound: true,
install: Some(world.register_system(|
mut commands: Commands,
root: Res<AppRoot>,
Expand All @@ -685,7 +691,7 @@ generate_upgrade_list!(

// Start background music
if let Some(instance) = audio_instances.get_mut(&music.0) {
instance.resume(AudioTween::new(Duration::from_secs_f32(0.15), AudioEasing::OutPowi(3)));
instance.resume(AudioTween::default());
} else {
error!("Background music has not loaded yet");
}
Expand Down Expand Up @@ -901,7 +907,7 @@ generate_upgrade_list!(
name: "10x Dev".to_string(),
desc: "Multiplies all code generation by VALUE.".to_string(),
value: 10.0,
hide_count: true,
no_count: true,
remaining: 6,
install: Some(world.register_system(move |
mut simulation: ResMut<Simulation>,
Expand Down Expand Up @@ -947,7 +953,7 @@ generate_upgrade_list!(
name: NAMES[0].to_string(),
desc: "Spawns VALUE entities whenever a line of code is produced.".to_string(),
value: 4.0,
hide_count: true,
no_count: true,
remaining: 6,
install: Some(world.register_system(move |
mut simulation: ResMut<Simulation>,
Expand Down

0 comments on commit 4c84fc1

Please sign in to comment.