packages feed

edge-0.8: SpaceJunk.hs

{-# LANGUAGE ExistentialQuantification #-}

module SpaceJunk where

import Animation
import Updating
import qualified Moving as M
import Combat

data SpaceJunk = forall a. ( InternallyUpdating a
                      , M.Colliding a
                      , Damaging a
                      , Damageable a
                      , Animation a
                      ) => SpaceJunk a

instance Damaging SpaceJunk where
  damageEnergy (SpaceJunk a) = damageEnergy a

instance Damageable SpaceJunk where
  inflictDamage (SpaceJunk a) et = SpaceJunk (inflictDamage a et)

instance InternallyUpdating SpaceJunk where
  preUpdate (SpaceJunk a) et = SpaceJunk (preUpdate a et)
  postUpdate (SpaceJunk a) et = SpaceJunk (postUpdate a et)

instance M.Colliding SpaceJunk where

  collisionRadius (SpaceJunk a) = M.collisionRadius a

instance M.Moving SpaceJunk where

  velocity (SpaceJunk a) = M.velocity a

instance M.Locatable SpaceJunk where
  center (SpaceJunk a) = M.center a

instance Animation SpaceJunk where
  image (SpaceJunk a) = image a