00001 #ifndef _RR_LOADERGLUE_H_
00002 #define _RR_LOADERGLUE_H_
00003
00004 #include <vrs/callback.h>
00005 #include <vrs/so.h>
00006 #include <vrs/vector.h>
00007
00008 namespace vrsode
00009 {
00010 class CollisionBody;
00011 }
00012
00013
00014 namespace random_racer
00015 {
00016
00017 class ReloadPlane;
00018 class TerrainLoader;
00019 class ItemDistributor;
00020
00024 class LoaderGlue : public VRS::SharedObj
00025 {
00029 struct Point
00030 {
00031 double x;
00032 double y;
00033 };
00034
00035 VRS::SO<VRS::Callback1<unsigned int> > m_callback;
00036 VRS::Vector m_position;
00037 VRS::SO<ReloadPlane> m_planes[4];
00038 VRS::SO<vrsode::CollisionBody> m_carBody;
00039 VRS::SO<TerrainLoader> m_loader;
00040 VRS::SO<ItemDistributor> m_itemDistributor;
00041 float m_halfBoxSize, m_centerDiff;
00042
00047 void relocatePlanesAround(double x, double y);
00048
00049 public:
00072 LoaderGlue(VRS::SO<vrsode::CollisionBody> collisionBody,
00073 VRS::SO<TerrainLoader> loader,
00074 float boxSize,
00075 float centerDiff,
00076 VRS::Vector position = VRS::Vector(0,0,0),
00077 VRS::SO<ItemDistributor> itemDistributor = NULL);
00078
00082 virtual ~LoaderGlue();
00083
00089 void collisionCallback(unsigned int planeId);
00090
00098 void registerPlanes(VRS::SO<ReloadPlane>* planeArray);
00099
00107 inline VRS::SO<VRS::Callback1<unsigned int> > getCallback()
00108 {
00109 return m_callback;
00110 }
00111
00115 void checkForCollisions();
00116 };
00117
00118 }
00119
00120
00121 #endif // _RR_LOADERGLUE_H_