#include <effects.h>
Inheritance diagram for Effect:
Public Types | |
typedef map< Object *, EffectHandler > | RecList |
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 RecList & | get_receiver_list (void)=0 |
virtual void | add_handler (Object *who) |
virtual void | clear_handlers () |
EffectHandler | find_handler (Object *who) |
Actor * | get_sender (void) |
const Vec3 | get_origin (void) |
Protected Attributes | |
Actor * | _sender |
who sent this effet. |
All Effects will derive from this.
|
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). |
|
Dummy constructor, pretty much here solely for adding to the receiver list. |
|
Constructor for Effect.
|
|
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. |
|
Apply this effect to the receiver, using the appropriate EffectHandler.
|
|
Apply this effect to everyone who cares about it, ie everyone in its WhoCares list. |
|
Clear all handlers. |
|
|
|
Implemented in BehaviorEffect, ElectricEffect, FearEffect, HeatEffect, HungerEffect, LightEffect, MeatEffect, PowerEffect, and VeggieEffect. |
|
|
|
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.
|