packages feed

edge-0.9.1.0: Universe.hs

{-|
Module      : Universe
Description : Defines the game state
Copyright   : (c) Christopher Howard, 2016
License     : GPL-3
Maintainer  : ch.howard@zoho.com
-}

module Universe where

import Prelude (Double, Bool(..), Maybe(..), Integer, Int)
import Data.WrapAround ( WP, WM, wrappoint, wrapmap )
import Sound.ALUT ( Source )

import Lance
import Star
import SpaceJunk
import Combat
import AfterEffect
import Unit
import ResourceTracker
import Item
import Common
import AWS

data Arena = Arena { lance :: Maybe Lance
                   , focus :: WP
                   , wrapMap :: WM
                   , asteroids :: [SpaceJunk]
                   , lanceProjectiles :: [Projectile]
                   , afterFX :: [AfterEffect]
                   , simpleUnits :: [SimpleUnit]
                   , smartUnits :: [SmartUnit]
                   , unitProjectiles :: [Projectile]
                   , items :: [Item]
                   }

data Universe = Universe { arena :: Arena
                         , level :: Int
                         , levels :: [Arena]
                         , lives :: Integer
                         , delayRemaining :: Double
                         , resourceTracker :: ResourceTracker
                         , skipLevel :: Bool
                         , levelMessageTimer :: Maybe Time
                         , panelActivationTimer :: Time
                         , startGameTimer :: Time
                         , queueBlipSound :: Bool
                         , blipSoundSource :: Maybe Source
                         , aws :: AWS
                         }

blankArena width height =
  let wmap = wrapmap width height in
  Arena { lance = Nothing
        , focus = wrappoint wmap (0, 0)
        , Universe.wrapMap = wmap
        , asteroids = []
        , lanceProjectiles = []
        , afterFX = []
        , simpleUnits = []
        , smartUnits = []
        , unitProjectiles = []
        , items = []
        }