00001 00006 00007 #ifndef KX_NEARSENSOR_H 00008 #define KX_NEARSENSOR_H 00009 00010 #include "KX_TouchSensor.h" 00011 #include "SM_Object.h" 00012 00013 class KX_NearSensor : public KX_TouchSensor 00014 { 00015 Py_Header; 00016 double m_Margin; 00017 double m_ResetMargin; 00018 00019 public: 00020 KX_NearSensor(class SCA_EventManager* eventmgr,class KX_GameObject* gameobj,double margin,double resetmargin,class SM_Object* sumoObj,bool bFindMaterial,const CCString& touchedpropname,PyTypeObject* T=&Type); 00021 virtual ~KX_NearSensor() { 00022 // for nearsensor, the sensor is the 'owner' of sumoobj 00023 // for touchsensor, it's the parent 00024 if (m_sumoObj) 00025 delete m_sumoObj; 00026 }; 00027 virtual CValue* GetReplica() { 00028 CValue* replica = new KX_NearSensor(*this); 00029 // this will copy properties and so on... 00030 CValue::AddDataToReplica(replica); 00031 return replica; 00032 }; 00033 virtual bool Evaluate(CValue* event); 00034 00035 virtual void HandleCollision(void* obj1,void* obj2, 00036 const DT_CollData * coll_data); 00037 00038 virtual PyObject* _getattr(char *attr); 00039 00040 }; 00041 #endif //KX_NEARSENSOR_H