Add sound effects to example analyser
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user