-
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.
## Fix - fixed a bug where the execution run condition `switch_just_*` was not working correctly. ## Breaking Change - rename `switch_turned_on` to ``switch_is_on` - rename `switch_turned_off` to `switch_is_on` - delete `Switch::just_turned_on` - delete `Switch::just_turned_off`
- Loading branch information
Showing
6 changed files
with
119 additions
and
87 deletions.
There are no files selected for viewing
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 @@ | ||
This module checks cases that cannot be tested by unit tests. |
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 @@ | ||
//! Testing that the system runs properly when the switch is switched | ||
|
||
use bevy::prelude::*; | ||
|
||
use bevy_flurx::prelude::*; | ||
|
||
struct S; | ||
|
||
fn main() { | ||
App::new() | ||
.add_plugins(( | ||
DefaultPlugins, | ||
FlurxPlugin | ||
)) | ||
.add_systems(Startup, setup) | ||
.add_systems(Update, ( | ||
console_switch_just_on::<1>.run_if(switch_just_turned_on::<S>), | ||
console_switch_just_on::<2>.run_if(switch_just_turned_on::<S>), | ||
console_switch_just_off::<1>.run_if(switch_just_turned_off::<S>), | ||
console_switch_just_off::<2>.run_if(switch_just_turned_off::<S>) | ||
)) | ||
.run(); | ||
} | ||
|
||
fn setup( | ||
mut commands: Commands | ||
) { | ||
commands.spawn(Reactor::schedule(|task| async move { | ||
loop { | ||
task.will(Update, wait::input::just_pressed().with(KeyCode::KeyT) | ||
.then(once::switch::on::<S>()) | ||
.then(delay::frames().with(1)) | ||
.then(wait::input::just_pressed().with(KeyCode::KeyT)) | ||
.then(once::switch::off::<S>()), | ||
).await; | ||
} | ||
})); | ||
} | ||
|
||
fn console_switch_just_on<const NUM: u8>() { | ||
println!("[{NUM}] switch just turned on!"); | ||
} | ||
|
||
fn console_switch_just_off<const NUM: u8>() { | ||
println!("[{NUM}] switch just turned off!"); | ||
} |
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