Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

obj_behaviour.h

Go to the documentation of this file.
00001 #ifndef __OBJECTBEHAVIOR_H
00002 #define __OBJECTBEHAVIOR_H
00003 
00004 //
00005 // BehaviourInterface
00006 //
00007 // Behaviours direct the motion of a class of
00008 // game objects.
00009 //
00010 // Behaviours also contain code that customize
00011 // individual game objects beyond what the
00012 // core components allow for.
00013 //
00014 // For example, BehaviourMissile contains code
00015 // to kill the missile when it touches a tile,
00016 // since [weakness to touch] applies only to
00017 // objects, and not tiles. (Were weakness to
00018 // touch to apply to tiles as well, then
00019 // the objects the player picks up would
00020 // be destroyed upon falling on the ground.)
00021 //
00022 // There's still some stuff to be worked out,
00023 // but all in all, it works out rather well.
00024 //
00025 
00026 class Object;
00027 
00028 class BehaviourInterface
00029 {
00030 protected:
00031   Object* obj;
00032 
00033 public:
00034   BehaviourInterface( Object* _obj ): obj( _obj ) {}
00035   virtual ~BehaviourInterface() {}
00036 
00037   // gets all bus messages through ObjComponent.
00038   virtual void Event( int evt )   {}
00039   virtual void HitTile( Tile* )   {}
00040   virtual void HitObj( Object* )  {}
00041 };
00042 
00043 class BehaviourPlayer: public BehaviourInterface
00044 {
00045 public:
00046   BehaviourPlayer( Object* _obj ): BehaviourInterface( _obj ) {}
00047   void Event( int evt );
00048 };
00049 
00050 class BehaviourMissile: public BehaviourInterface
00051 {
00052 public:
00053   BehaviourMissile( Object* _obj ): BehaviourInterface( _obj ) {}
00054   void Event( int evt );
00055   void HitTile( Tile* );
00056 };
00057 
00058 #endif // __OBJECTBEHAVIOR_H

Generated on Sun Mar 2 18:50:27 2003 for eounicorn by doxygen1.3-rc3