packages feed

edge-0.9.1.0: Updating.hs

{-|
Module      : Updating
Description : Interfaces for objects which update over time
Copyright   : (c) Christopher Howard, 2016
License     : GPL-3
Maintainer  : ch.howard@zoho.com
-}

module Updating where

import Prelude (Maybe(..), Bool(..))

import {-# SOURCE #-} AfterEffect ( AfterEffect )
import {-# SOURCE #-} Universe ( Arena )
import Common

class InternallyUpdating a where
  preUpdate :: a -> Time -> a
  postUpdate :: a -> Time -> a

{-|
  Objects that exist temporarily or that may die after being wounded a certain
  amount. Should be used for objects whose continued existence depends on some
  internal variable, e.g., a lifeforce or countdown that may reach zero.
-}
class (InternallyUpdating a) => Transient a where

  expired' :: a -> Maybe [AfterEffect]

class (InternallyUpdating a) => SimpleTransient a where

  expired :: a -> Bool

class Observant a where

  updateVision :: a -> Arena -> a