packages feed

edge-0.9.1.0: SpaceJunk.hs

{-# LANGUAGE ExistentialQuantification #-}

{-|
Module      : SpaceJunk
Description : Defines non-hostile but damaging space objects
Copyright   : (c) Christopher Howard, 2016
License     : GPL-3
Maintainer  : ch.howard@zoho.com
-}
module SpaceJunk where

import Prelude ()
import Animation
import Updating
import Moving
import Combat

data SpaceJunk = forall a. ( InternallyUpdating a
                      , 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 Colliding SpaceJunk where

  collisionRadius (SpaceJunk a) = collisionRadius a

instance Moving SpaceJunk where

  velocity (SpaceJunk a) = velocity a

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

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