packages feed

edge-0.8.2: Updating.hs

module Updating where

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

  {- 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