38 lines
743 B
Haskell
38 lines
743 B
Haskell
{-# LANGUAGE ExistentialQuantification #-}
|
|
module Types.Cast where
|
|
|
|
-- internale imports
|
|
|
|
import Classes.Actor
|
|
import Physics.Classes
|
|
|
|
data Cast = forall a. Actor a => Cast a
|
|
|
|
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
|
|
|
|
collide (Cast c1) res dt = Cast $ collide c1 res dt
|