packages feed

edge-0.8: Updating.hs

module Updating where

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

-- Double is elapsed time in seconds
class InternallyUpdating a where
  preUpdate :: a -> Double -> a
  postUpdate :: a -> Double -> 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

  {- Whether or not the object should be removed from existence -}
  expired' :: a -> Maybe [AfterEffect]

class (InternallyUpdating a) => SimpleTransient a where

  expired :: a -> Bool

class Observant a where

  updateVision :: a -> Arena -> a