Rename field in preparation for adding generic generator support.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2022-09-10 08:34:23 -05:00
parent f6f29653d6
commit 1108e3e75e
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ use crate::{commands::RunIfExistsExt, core::PointLike};
#[derive(Component, Clone, Debug, Reflect)]
#[reflect(Component)]
pub struct Footstep {
pub sound: Handle<Buffer>,
pub buffer: Handle<Buffer>,
pub step_length: f32,
pub gain: f64,
pub pitch: Option<f64>,
@ -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<Footstep>>) {
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,

View File

@ -14,7 +14,7 @@ use crate::{
#[derive(Component, Clone, Debug)]
pub struct SoundIcon {
pub sound: Handle<Buffer>,
pub buffer: Handle<Buffer>,
pub gain: f64,
pub pitch: f64,
pub interval: Option<Timer>,
@ -24,7 +24,7 @@ impl Default for SoundIcon {
fn default() -> Self {
let seconds = random::<f32>() + 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<SoundIcon>>) {
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<S>(
interval.reset();
}
}
let buffer = icon.sound.clone();
let buffer = icon.buffer.clone();
if sound.buffer != buffer {
sound.buffer = buffer;
}