Advertisement
Guest User

Untitled

a guest
Jan 8th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.43 KB | None | 0 0
  1. pub struct SoundSys;
  2. impl<'a> System<'a> for SoundSys {
  3.     type SystemData = (
  4.         WriteStorage<'a, SoundComp>,
  5.    );
  6.  
  7.    fn run(&mut self, data: Self::SystemData) {
  8.        let mut sound_comp = data;
  9.  
  10.        for s in (&mut sound_comp).join() {
  11.            for sound_to_play in &s.to_play {
  12.                s.sounds[&sound_to_play].play().unwrap();
  13.            }
  14.  
  15.            s.to_play = Vec::new();
  16.        }
  17.    }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement