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
|
|
|
|
|
|
|
|
acceleration (Cast a) = acceleration a
|
|
|
|
|
|
|
|
accelerationUpdater (Cast a) = Cast . accelerationUpdater a
|
|
|
|
|
|
|
|
velocity (Cast a) = velocity a
|
|
|
|
|
|
|
|
velocityUpdater (Cast a) = Cast . velocityUpdater a
|
|
|
|
|
|
|
|
position (Cast a) = position a
|
|
|
|
|
|
|
|
positionUpdater (Cast a) = Cast . positionUpdater a
|
|
|
|
|
|
|
|
instance Collidible Cast where
|
|
|
|
|
|
|
|
boundary (Cast c) = boundary c
|
|
|
|
|
|
|
|
collisionCheck dt (Cast c1) c2 = collisionCheck dt c1 c2
|
|
|
|
|
2021-07-24 07:35:41 +00:00
|
|
|
collide (Cast c1) res dt = Cast $ collide c1 res dt
|