2020-12-16 17:57:37 +00:00
|
|
|
{-# LANGUAGE ExistentialQuantification #-}
|
|
|
|
module Types.Cast where
|
|
|
|
|
|
|
|
-- internale imports
|
|
|
|
|
|
|
|
import Classes.Actor
|
2021-07-08 16:39:31 +00:00
|
|
|
import Physics.Classes
|
2020-12-16 17:57:37 +00:00
|
|
|
|
|
|
|
data Cast = forall a. Actor a => Cast a
|
2021-07-08 16:39:31 +00:00
|
|
|
|
|
|
|
instance Show Cast where
|
|
|
|
|
|
|
|
show (Cast a) = show a
|
|
|
|
|
|
|
|
instance Mass Cast where
|
|
|
|
|
|
|
|
mass (Cast a) = mass a
|
|
|
|
|
|
|
|
velocity (Cast a) = velocity a
|
|
|
|
|
|
|
|
velocityUpdater (Cast a) = Cast . velocityUpdater a
|
|
|
|
|
2021-09-05 08:46:33 +00:00
|
|
|
forces (Cast a) = forces a
|
|
|
|
|
|
|
|
forcesUpdater (Cast a) = Cast . forcesUpdater a
|
|
|
|
|
2021-07-08 16:39:31 +00:00
|
|
|
position (Cast a) = position a
|
|
|
|
|
|
|
|
positionUpdater (Cast a) = Cast . positionUpdater a
|
|
|
|
|
|
|
|
instance Collidible Cast where
|
|
|
|
|
2021-09-05 08:46:33 +00:00
|
|
|
prevPosition (Cast c) = prevPosition c
|
|
|
|
|
|
|
|
impactForces (Cast c) = impactForces c
|
|
|
|
|
|
|
|
impactForcesUpdater (Cast c) = Cast . impactForcesUpdater c
|
|
|
|
|
|
|
|
collisionOccured (Cast c) = collisionOccured c
|
|
|
|
|
|
|
|
updateCollisionOccurence (Cast c) = Cast . updateCollisionOccurence c
|
|
|
|
|
2021-07-08 16:39:31 +00:00
|
|
|
boundary (Cast c) = boundary c
|
|
|
|
|
2021-09-05 08:46:33 +00:00
|
|
|
collisionCheck (Cast c1) c2 = collisionCheck c1 c2
|
2021-07-08 16:39:31 +00:00
|
|
|
|
2021-07-24 07:35:41 +00:00
|
|
|
collide (Cast c1) res dt = Cast $ collide c1 res dt
|