Advertisement
Guest User

Untitled

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