00001 #include "ext_stl.h" 00002 00003 #include "ai.h" 00004 #include "collidable.h" 00006 class Spectre: public IdCollidable { 00007 public: 00009 00012 class CollideKey { 00013 public: 00014 int surface; 00015 00016 00017 double radius; 00018 CollideKey (int s=0,double r=0.):surface(s),radius(r){} 00019 00020 00021 bool operator < (const CollideKey & b) const{ 00022 if (surface==b.surface) 00023 return radius<b.radius; 00024 return surface<b.surface; 00025 } 00026 }; 00027 private: 00028 float shields; 00029 int ammo; 00030 AutoCloner <AI>ai; 00031 void calculateCollideKey (int surface) { 00032 collideKey.radius=getPosition().Magnitude2d(); 00033 collideKey.surface=surface; 00034 } 00035 protected: 00036 CollideKey collideKey; 00037 public: 00038 void collide (Spectre *oth); 00039 Spectre () : IdCollidable () {} 00040 Spectre (std::string name, const Matrix &mat, int surface, int id=-1); 00041 // : IdCollidable (name, mat, id) {} 00042 void setPosition (const QVector &newPos) { 00043 pos.pos()=newPos; 00044 //ssss calculateCollideKey(collideKey.surface); DEPRECATED!!! WATCH OUT 00045 } 00046 void update(); 00047 void draw (class Surface *par);// { 00048 // model->Draw (par->toWorld(pos)); 00049 // } 00051 CollideKey recalculateCollideKey () const { 00052 return CollideKey(collideKey.surface, getPosition().Magnitude2d()); 00053 } 00055 void changeKey (const CollideKey &key) { 00056 collideKey=key; 00057 } 00059 CollideKey getCollideKey () { 00060 return collideKey; 00061 } 00062 }; 00063 00064