Refactor material sounds

This commit is contained in:
2022-06-19 21:21:33 +01:00
parent 08e5df07e2
commit 8d81104f5f
14 changed files with 236 additions and 231 deletions
+6 -16
View File
@@ -1,8 +1,6 @@
module Dodge.WorldEvent.Sound
( mkSoundBreakGlass
, mkSoundSplinterGlass
, mkSoundSplinterBlock
, originIDsAt
( originIDsAt
, originsIDsAt
) where
import Dodge.Data
import Dodge.SoundLogic
@@ -11,20 +9,12 @@ import Geometry.Data
import RandomHelp
import Control.Lens
originsIDsAt :: [SoundOrigin] -> [SoundID] -> Point2 -> World -> World
originsIDsAt sos sids p w = soundMultiFrom sos p sid Nothing $ set randGen g w
where
(sid,g) = _randGen w & runState (takeOne sids)
originIDsAt :: SoundOrigin -> [SoundID] -> Point2 -> World -> World
originIDsAt so sids p w = soundStart so p sid Nothing $ set randGen g w
where
(sid,g) = _randGen w & runState (takeOne sids)
mkSoundBreakGlass :: Point2 -> World -> World
mkSoundBreakGlass = originIDsAt (GlassBreakSound 0)
[glassShat1S,glassShat2S,glassShat3S,glassShat4S]
mkSoundSplinterGlass :: Point2 -> World -> World
mkSoundSplinterGlass = originIDsAt (GlassBreakSound 1)
[smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S]
mkSoundSplinterBlock :: Point2 -> World -> World
mkSoundSplinterBlock = originIDsAt (BlockDegradeSound 1)
[impact1S,impact2S,impact3S,impact4S]