00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ENT_AMMO_H
00028 #define ENT_AMMO_H
00029
00030 #include <PVLE/Config.h>
00031 #include <PVLE/Export.h>
00032 #include <PVLE/Entity/3DPhy.h>
00033 #include <PVLE/Entity/WeaponEnergy.h>
00034
00062 class PVLE_EXPORT Ammo : public C3DPhy {
00063 public:
00064
00065
00066 Ammo(osg::MatrixTransform * pModel, Physics::Geom * pGeom, C3DPhy::EInitOptions options, const C3DPhy * pInheritTeamAndPlayer = NULL);
00067 Ammo(const C3DPhy & v, UINT copyOpts = COPY_3D | COPY_PHYSICS | COPY_OWNER);
00068 Ammo(const Ammo & v, UINT copyOpts = COPY_3D | COPY_PHYSICS | COPY_OWNER);
00069
00070 virtual EContainerType getType() const { return AMMO; }
00071 virtual Ammo * asAmmo() { return this; }
00072
00075
00077 void setMinSpeed2(float minSpeed2) { this->minSpeed2 = minSpeed2; }
00078 float getMinSpeed2() const { return minSpeed2; }
00079
00081 void setMinCollisionCineticToDestroy(float energy) { ASSERT(energy>=0); minCollisionCineticToDestroy = energy; }
00082 float getMinCollisionCineticToDestroy() const { return minCollisionCineticToDestroy; }
00084
00086 virtual void step(dReal stepSize);
00088 virtual bool hitBefore(Physics::Contact * pContacts, unsigned int nbContacts, Physics::Contact * pMaxEnergyContact, Physics::Geom & thisGeom, Physics::Geom & otherGeom, Physics::Body *& inout_pThisBody, Physics::Body *& inout_pOtherBody);
00090 virtual void hitAfter(Physics::Contact * pContacts, unsigned int nbContacts, Physics::Contact * pMaxEnergyContact, Physics::Geom & thisGeom, Physics::Geom & otherGeom, bool contactJointCreated);
00091
00103
00105 void setParam(WeaponEnergy::EEneryType energyType, float value) { vParams[energyType] = value; }
00106 float getParam(WeaponEnergy::EEneryType energyType) const { return vParams[energyType]; }
00108
00111
00113
00114
00116
00117
00118 #ifdef PVLE_NETWORKING
00121 //virtual TNL::U32 packUpdate(TNL::GhostConnection * pConnection, TNL::U32 mask, TNL::BitStream * pStream);
00122
00124 #endif
00125
00126 protected:
00127
00128
00129
00130 float vParams[WeaponEnergy::MAX_WEAPON_ENERGY];
00131 bool canBeDeletedOnNextFrame;
00132 float minSpeed2, minCollisionCineticToDestroy;
00133 float lastPerforationEnergy;
00134 };
00135
00136
00137
00147
00148
00149
00150
00151
00152
00153
00154
00155
00157
00158
00159
00160
00161 #endif // ENT_AMMO_H