Add shatterGun
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module Dodge.Block.Debris where
|
||||
import Dodge.Prop.Moving
|
||||
import Dodge.WorldEvent.Sound
|
||||
import Dodge.SoundLogic
|
||||
--import Dodge.Zone
|
||||
import Dodge.Base
|
||||
import Dodge.Data
|
||||
@@ -13,17 +15,21 @@ import RandomHelp
|
||||
import qualified Quaternion as Q
|
||||
--import Data.List (zip4)
|
||||
|
||||
makeBlockDebris :: BlockMaterial -> Block -> World -> World
|
||||
makeBlockDebris _ bl w = w
|
||||
makeBlockDebris :: Block -> World -> World
|
||||
makeBlockDebris bl = makeDebris (_blMaterial bl) (_blPos bl)
|
||||
|
||||
makeDebris :: BlockMaterial -> Point2 -> World -> World
|
||||
makeDebris bm p w = w
|
||||
& flip (foldr (plNew props pjID)) thedebris
|
||||
& randGen .~ newg
|
||||
& matDesSound bm p
|
||||
where
|
||||
(thedebris,newg) = runState (mapM f [35,55..95]) $ _randGen w
|
||||
f h = do
|
||||
v <- randInCirc 2
|
||||
q <- Q.vToQuat (V3 0 0 1) <$> randOnUnitSphere
|
||||
return $ someDebris
|
||||
& prPos .~ _blPos bl
|
||||
& prPos .~ p
|
||||
& pjColor .~ greyN 0.5
|
||||
& pjVel .~ v
|
||||
& pjQuatSpin .~ Q.axisAngle (vNormal v `v2z` 0) (-0.1)
|
||||
@@ -48,3 +54,11 @@ someDebris = PropZ
|
||||
}
|
||||
debrisShape :: Float -> Prop -> Shape
|
||||
debrisShape size pr = colorSH (_pjColor pr) . translateSHz (-size) $ upperPrismPoly 8 $ square size
|
||||
|
||||
matDesSound :: BlockMaterial -> Point2 -> World -> World
|
||||
matDesSound mat = case mat of
|
||||
GlassBlock -> mkSoundBreakGlass
|
||||
StoneBlock -> mkSoundSplinterBlock
|
||||
DirtBlock -> originIDsAt (BlockDegradeSound 1) [impact1S,impact3S]
|
||||
WoodBlock -> originIDsAt (BlockDegradeSound 1) [impact1S,impact2S,impact3S]
|
||||
MetalBlock -> originIDsAt (BlockDegradeSound 1) [impact2S,impact3S]
|
||||
|
||||
Reference in New Issue
Block a user