Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Effect Class Reference

#include <effects.h>

Inheritance diagram for Effect:

BehaviorEffect PowerEffect FearEffect HungerEffect ElectricEffect HeatEffect LightEffect MeatEffect VeggieEffect List of all members.

Public Types

typedef map< Object *, EffectHandlerRecList

Public Member Functions

 Effect (void)
 Effect (Actor *sender)
virtual void pre_apply (Object *who)
virtual void apply_to (Object *who)
virtual void apply_to_all (void)
virtual RecListget_receiver_list (void)=0
virtual void add_handler (Object *who)
virtual void clear_handlers ()
EffectHandler find_handler (Object *who)
Actorget_sender (void)
const Vec3 get_origin (void)

Protected Attributes

Actor_sender
 who sent this effet.


Detailed Description

A message from one object to another that some effect is being exerted.

All Effects will derive from this.


Member Typedef Documentation

typedef map<Object*, EffectHandler> Effect::RecList
 

A list of "who cares about this effect".

Each Effect will probably maintain a list of which Objects actually respond to that type of effect, as an optimization (so we don't waste time trying to apply CheeseEffect's to BowlingBalls).


Constructor & Destructor Documentation

Effect::Effect void   )  [inline]
 

Dummy constructor, pretty much here solely for adding to the receiver list.

Effect::Effect Actor sender  )  [inline]
 

Constructor for Effect.

Parameters:
sender who sent this effect.


Member Function Documentation

void Effect::add_handler Object who  )  [virtual]
 

Add who's effect handler for this effect to our receiver list. this can't be a static function, because we need an actual instance of some Effect class to pass to who's get_handler() function.

void Effect::apply_to Object who  )  [virtual]
 

Apply this effect to the receiver, using the appropriate EffectHandler.

Parameters:
who who to apply the effect to

void Effect::apply_to_all void   )  [virtual]
 

Apply this effect to everyone who cares about it, ie everyone in its WhoCares list.

void Effect::clear_handlers  )  [virtual]
 

Clear all handlers.

EffectHandler Effect::find_handler Object who  )  [inline]
 

Parameters:
who the receiver we're interesting in finding a handler for.
Returns:
the EffectHandler that receiver who has designated as the handler for this type of effect.

virtual RecList& Effect::get_receiver_list void   )  [pure virtual]
 

Returns:
the WhoCares list.

Implemented in BehaviorEffect, ElectricEffect, FearEffect, HeatEffect, HungerEffect, LightEffect, MeatEffect, PowerEffect, and VeggieEffect.

Actor* Effect::get_sender void   )  [inline]
 

Returns:
who sent this effect.

void Effect::pre_apply Object who  )  [virtual]
 

Calculations needed prior to application of the effect.

Sometimes an Effect needs to do some calculations before it applies itself to the receiver. This function is called prior to each application, allowing fine-tuning.

See also:
Gravity
Parameters:
who who we are about to apply the effect to


The documentation for this class was generated from the following files:
Generated on Sat Mar 13 15:00:10 2004 by doxygen 1.3.5