Migrate more doors to lerp
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Placement.PlaceSpot.TriggerDoor (
|
||||
updateDoorEdges,
|
||||
) where
|
||||
|
||||
import Dodge.ShiftPoint
|
||||
import Linear
|
||||
import Dodge.Data.GenWorld
|
||||
import qualified Data.IntSet as IS
|
||||
@@ -23,10 +24,12 @@ plDoor ::
|
||||
WdBl ->
|
||||
-- | Door positions, closed to open.
|
||||
-- Bumped out up and down by 9, not widened
|
||||
[(Point2, Point2)] ->
|
||||
Float ->
|
||||
Point2A ->
|
||||
Point2A ->
|
||||
GenWorld ->
|
||||
(Int, GenWorld)
|
||||
plDoor col eo cond pss gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor) -- carefull with the ordering of addWalls
|
||||
plDoor col eo cond l p1 p2 gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor) -- carefull with the ordering of addWalls
|
||||
where
|
||||
drid = IM.newKey $ _doors (_lWorld (_cWorld $ _gwWorld gw))
|
||||
addDoor =
|
||||
@@ -36,16 +39,24 @@ plDoor col eo cond pss gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld
|
||||
, _drWallIDs = IS.fromList wlids
|
||||
, _drStatus = DoorInt 0
|
||||
, _drTrigger = cond
|
||||
, _drMech = DrWdMechanismStepwise nsteps wlids pss
|
||||
, _drPos = head pss
|
||||
, _drOpenPos = head pss
|
||||
, _drClosePos = last pss
|
||||
--, _drMech = DrWdMechanismStepwise nsteps wlids pss
|
||||
, _drMech = DoorLerp
|
||||
-- , _drPos = head pss
|
||||
-- , _drOpenPos = head pss
|
||||
-- , _drClosePos = last pss
|
||||
, _drZeroPos = p1
|
||||
, _drOnePos = p2
|
||||
, _drLerp = 0
|
||||
, _drFootPrint = IM.fromList . zip wlids $ wlps'
|
||||
, _drObstacleType = eo
|
||||
, _drSpeed = 0.01
|
||||
}
|
||||
nsteps = length pss - 1
|
||||
-- nsteps = length pss - 1
|
||||
wlids = take 4 [IM.newKey $ _walls (_lWorld (_cWorld $ _gwWorld gw)) ..]
|
||||
wlps' = uncurry (rectanglePairs 9) $ head pss
|
||||
addWalls w' = foldl' (addDoorWall eo drid $ switchWallCol col) w' $ zip wlids wlps'
|
||||
--wlps' = uncurry (rectanglePairs 9) $ head pss
|
||||
wlps' = rectanglePairs 9 0 (V2 l 0)
|
||||
addWalls w' = foldl' (addDoorWall eo drid $ switchWallCol col) w' $ zip wlids
|
||||
$ wlps' & each . each %~ shiftPointBy p1
|
||||
|
||||
addDoorWall :: EdgeObstacle -> Int -> Wall -> World -> (Int, (Point2, Point2)) -> World
|
||||
addDoorWall eo drid wl w (wlid, wlps) =
|
||||
|
||||
Reference in New Issue
Block a user