Implement basic attention and awareness

This commit is contained in:
2021-05-08 17:34:25 +02:00
parent 1aa59cc205
commit 86faf9fd01
12 changed files with 243 additions and 135 deletions
+15 -1
View File
@@ -7,6 +7,7 @@ module Dodge.Creature.Picture
) where
import Dodge.Data
import Dodge.Creature.State.Data
import Dodge.Creature.AlertLevel.Data
import Dodge.Picture.Layer
import Picture
import Geometry
@@ -18,7 +19,11 @@ basicCrPict
:: Color -- ^ Creature color
-> Creature
-> Picture
basicCrPict col cr = pictures [ onLayer CrLayer . piercingMod $ bluntScale naked , drawEquipment cr]
basicCrPict col cr = pictures
[ onLayer CrLayer . piercingMod $ bluntScale naked
, drawAwakeLevel cr
, drawEquipment cr
]
where
cdir = _crDir cr
naked
@@ -46,6 +51,15 @@ basicCrPict col cr = pictures [ onLayer CrLayer . piercingMod $ bluntScale naked
Nothing -> False
Just x -> x > 5
drawAwakeLevel
:: Creature
-> Picture
drawAwakeLevel cr = case cr ^? crAttentionDir of
Just (AttentiveTo [0]) -> setPos . color red $ circleSolid 5
_ -> setPos . color blue $ circleSolid 5
where
setPos = translate 0 (_crRad cr)
drawEquipment
:: Creature
-> Picture