First implementation of creatures detecting sounds
This commit is contained in:
@@ -10,7 +10,7 @@ import Dodge.Creature.Memory.Data
|
||||
import Dodge.Base.Collide
|
||||
import Geometry.Vector
|
||||
--import Geometry.Data
|
||||
--import Sound.Data
|
||||
import Sound.Data
|
||||
--import StrictHelp
|
||||
|
||||
import Data.Maybe
|
||||
@@ -88,12 +88,11 @@ awakeLevelPerception cr = case _crAwakeLevel $ _crPerception cr of
|
||||
Overstrung -> 10000
|
||||
|
||||
newSounds :: World -> [(Point2,Float)]
|
||||
newSounds = mapMaybe f . M.elems . _sounds
|
||||
newSounds = mapMaybe f . M.elems . _playingSounds
|
||||
where
|
||||
f s = Just (_soundPos s, _soundVolume s)
|
||||
-- f s | _soundStatus s == JustStartedPlaying
|
||||
-- = Just (_soundPos s, _soundVolume s)
|
||||
-- | otherwise = Nothing
|
||||
f s | _soundStatus s == JustStartedPlaying
|
||||
= Just (_soundPos s, _soundVolume s)
|
||||
| otherwise = Nothing
|
||||
|
||||
rememberSounds :: Creature -> Reader World Creature
|
||||
rememberSounds cr = do
|
||||
@@ -102,4 +101,4 @@ rememberSounds cr = do
|
||||
-- return $ cr & crMemory . soundsToInvestigate .~ [V2 0 0]
|
||||
|
||||
soundIsClose :: Creature -> (Point2,Float) -> Bool
|
||||
soundIsClose cr (pos,vol) = True -- vol > (_auDist . _crAudition $ _crPerception cr) (dist pos (_crPos cr))
|
||||
soundIsClose cr (pos,vol) = vol > (_auDist . _crAudition $ _crPerception cr) (dist pos (_crPos cr))
|
||||
|
||||
Reference in New Issue
Block a user