From 1108e3e75e7222a2fcb027d032dd7f0d2adf0574 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Sat, 10 Sep 2022 08:34:23 -0500 Subject: [PATCH] Rename field in preparation for adding generic generator support. --- src/sound/footstep.rs | 6 +++--- src/sound/icon.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sound/footstep.rs b/src/sound/footstep.rs index 7400dce..1042e38 100644 --- a/src/sound/footstep.rs +++ b/src/sound/footstep.rs @@ -9,7 +9,7 @@ use crate::{commands::RunIfExistsExt, core::PointLike}; #[derive(Component, Clone, Debug, Reflect)] #[reflect(Component)] pub struct Footstep { - pub sound: Handle, + pub buffer: Handle, pub step_length: f32, pub gain: f64, pub pitch: Option, @@ -19,7 +19,7 @@ pub struct Footstep { impl Default for Footstep { fn default() -> Self { Self { - sound: default(), + buffer: default(), step_length: 0.8, gain: 1., pitch: None, @@ -30,7 +30,7 @@ impl Default for Footstep { fn added(mut commands: Commands, footsteps: Query<(Entity, &Footstep), Added>) { for (entity, footstep) in footsteps.iter() { - let buffer = footstep.sound.clone(); + let buffer = footstep.buffer.clone(); commands.run_if_exists(entity, move |mut entity| { entity.insert(Sound { buffer, diff --git a/src/sound/icon.rs b/src/sound/icon.rs index e68a12d..14c6517 100644 --- a/src/sound/icon.rs +++ b/src/sound/icon.rs @@ -14,7 +14,7 @@ use crate::{ #[derive(Component, Clone, Debug)] pub struct SoundIcon { - pub sound: Handle, + pub buffer: Handle, pub gain: f64, pub pitch: f64, pub interval: Option, @@ -24,7 +24,7 @@ impl Default for SoundIcon { fn default() -> Self { let seconds = random::() + 4.5; let mut icon = Self { - sound: default(), + buffer: default(), gain: 1., pitch: 1., interval: Some(Timer::from_seconds(seconds, true)), @@ -39,7 +39,7 @@ impl Default for SoundIcon { fn added(mut commands: Commands, icons: Query<(Entity, &SoundIcon), Added>) { for (entity, icon) in icons.iter() { - let buffer = icon.sound.clone(); + let buffer = icon.buffer.clone(); let gain = icon.gain; let pitch = icon.pitch; let looping = icon.interval.is_none(); @@ -95,7 +95,7 @@ fn update( interval.reset(); } } - let buffer = icon.sound.clone(); + let buffer = icon.buffer.clone(); if sound.buffer != buffer { sound.buffer = buffer; }