00001
00007
00008 #ifndef __KX_RANDOMACTUATOR
00009 #define __KX_RANDOMACTUATOR
00010
00011 #include "SCA_IActuator.h"
00012 #include "SCA_RandomNumberGenerator.h"
00013
00014 class SCA_RandomActuator : public SCA_IActuator
00015 {
00016 Py_Header;
00018 CCString m_propname;
00019
00022 float m_parameter1;
00025 float m_parameter2;
00026
00028 SCA_RandomNumberGenerator *m_base;
00029
00031 int m_counter;
00032
00034 long m_previous;
00035
00037 void enforceConstraints(void);
00038
00039 public:
00040
00041 enum KX_RANDOMACT_MODE {
00042 KX_RANDOMACT_NODEF,
00043 KX_RANDOMACT_BOOL_CONST,
00044 KX_RANDOMACT_BOOL_UNIFORM,
00045 KX_RANDOMACT_BOOL_BERNOUILLI,
00046 KX_RANDOMACT_INT_CONST,
00047 KX_RANDOMACT_INT_UNIFORM,
00048 KX_RANDOMACT_INT_POISSON,
00049 KX_RANDOMACT_FLOAT_CONST,
00050 KX_RANDOMACT_FLOAT_UNIFORM,
00051 KX_RANDOMACT_FLOAT_NORMAL,
00052 KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL,
00053 KX_RANDOMACT_MAX
00054 };
00056 KX_RANDOMACT_MODE m_distribution;
00057
00058 SCA_RandomActuator(class SCA_IObject* gameobj,
00059 long seed,
00060 KX_RANDOMACT_MODE mode,
00061 float para1,
00062 float para2,
00063 const CCString &propName,
00064 PyTypeObject* T=&Type);
00065 virtual ~SCA_RandomActuator();
00066 virtual bool Update(double curtime,double deltatime);
00067
00068 virtual CValue* GetReplica() {
00069 SCA_RandomActuator* replica = new SCA_RandomActuator(*this);
00070 replica->ProcessReplica();
00071 CValue::AddDataToReplica(replica);
00072 return replica;
00073 };
00074
00075
00076
00077
00078
00079 virtual PyObject* _getattr(char *attr);
00080
00081
00082 KX_PYMETHOD_DOC(SCA_RandomActuator,SetSeed);
00083
00084 KX_PYMETHOD_DOC(SCA_RandomActuator,GetSeed);
00085
00086
00087 KX_PYMETHOD_DOC(SCA_RandomActuator,GetPara1);
00088
00089
00090 KX_PYMETHOD_DOC(SCA_RandomActuator,GetPara2);
00091
00092
00093 KX_PYMETHOD_DOC(SCA_RandomActuator,GetDistribution);
00094
00095 KX_PYMETHOD_DOC(SCA_RandomActuator,SetProperty);
00096
00097 KX_PYMETHOD_DOC(SCA_RandomActuator,GetProperty);
00098
00099 KX_PYMETHOD_DOC(SCA_RandomActuator,SetBoolConst);
00100
00101 KX_PYMETHOD_DOC(SCA_RandomActuator,SetBoolUniform);
00102
00103 KX_PYMETHOD_DOC(SCA_RandomActuator,SetBoolBernouilli);
00104
00105 KX_PYMETHOD_DOC(SCA_RandomActuator,SetIntConst);
00106
00107 KX_PYMETHOD_DOC(SCA_RandomActuator,SetIntUniform);
00108
00109 KX_PYMETHOD_DOC(SCA_RandomActuator,SetIntPoisson);
00110
00111 KX_PYMETHOD_DOC(SCA_RandomActuator,SetFloatConst);
00112
00113 KX_PYMETHOD_DOC(SCA_RandomActuator,SetFloatUniform);
00114
00115 KX_PYMETHOD_DOC(SCA_RandomActuator,SetFloatNormal);
00116
00117 KX_PYMETHOD_DOC(SCA_RandomActuator,SetFloatNegativeExponential);
00118
00119 };
00120
00121 #endif