Make Seed a component
Conceptually it works better as a resource, but that's an extra layer of complexity for the upcoming automatic distribution work.
This commit is contained in:
parent
9ab8db41de
commit
d89d539f3b
5 changed files with 15 additions and 29 deletions
|
|
@ -23,7 +23,7 @@ const BALL_COUNT: u8 = 32;
|
|||
const BALL_SIZES: Range<f32> = 10.0..25.0;
|
||||
const DIMENSION_SIZES: Range<f32> = 500.0..2000.0;
|
||||
|
||||
pub fn check_for_seed(seed: Option<Res<Seed>>, mut next_state: ResMut<NextState<AppState>>) {
|
||||
pub fn check_for_seed(seed: Option<Single<&Seed>>, mut next_state: ResMut<NextState<AppState>>) {
|
||||
if seed.is_some() {
|
||||
next_state.set(AppState::InGame);
|
||||
}
|
||||
|
|
@ -34,8 +34,8 @@ pub fn check_for_seed(seed: Option<Res<Seed>>, mut next_state: ResMut<NextState<
|
|||
pub struct PlayableArea(f32, f32);
|
||||
|
||||
/// Initialize deterministic values
|
||||
pub fn setup_from_seed(mut commands: Commands, seed: Res<Seed>) {
|
||||
let mut rng = WyRand::from_seed((*seed).into());
|
||||
pub fn setup_from_seed(mut commands: Commands, seed: Single<&Seed>) {
|
||||
let mut rng = WyRand::from_seed((**seed).into());
|
||||
commands.insert_resource(PlayableArea(
|
||||
rng.random_range(DIMENSION_SIZES),
|
||||
rng.random_range(DIMENSION_SIZES),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue