Add sound effects to example analyser

This commit is contained in:
2022-03-22 10:53:01 +00:00
parent c0383dbd8a
commit 4cd7cf4edd
10 changed files with 236 additions and 197 deletions
+3 -2
View File
@@ -26,6 +26,7 @@ damageSensor dt wdth upf ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1)
$ \gw -> (,) gw $ PutMachine yellow (reverse $ square wdth) defaultMachine
{ _mcDraw = sensorSPic wdth $ _sensorCoding (_gParams gw) M.! dt
, _mcUpdate = \mc -> upf mc . sensorUpdate dt mc
, _mcSensor = SensorToggleAmount False 0
, _mcLSs = [lsid]
}
@@ -36,10 +37,10 @@ sensorUpdate :: DamageType -> Machine -> World -> World
sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
& lightSources . ix lsid %~ upls
where
upmc = ( mcSensorAmount %~ \x' -> min 1000 (max 0 (x' - 5 + newSense)) )
upmc = ( mcSensor . sensAmount %~ \x' -> min 1000 (max 0 (x' - 5 + newSense)) )
. ( mcHP -~ sum dam )
. (mcDamage .~ [])
x = _mcSensorAmount mc
x = _sensAmount $ _mcSensor mc
mcid = _mcID mc
lsid = head (_mcLSs mc)
(senseData,dam) = partitionEithers $ map (damageUsing damF) $ _mcDamage mc