BVB Source Codes

CRYENGINE Show VehicleDamageBehaviorSpawnDebris.h Source code

Return Download CRYENGINE: download VehicleDamageBehaviorSpawnDebris.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __VEHICLEDAMAGEBEHAVIORSPAWNDEBRIS_H__
  4. #define __VEHICLEDAMAGEBEHAVIORSPAWNDEBRIS_H__
  5.  
  6. class CVehiclePartAnimated;
  7.  
  8. //! When triggered, this behavior spawns geometry with a randomized impulse and an optional particle effect.
  9. //! The debris is automatically generated from all the vehicle animated parts that have a configured destroyed geometry.
  10. //! The geometry will be spawned from the joint the part is attached to.
  11. //! This a behaviour applied to the entire vehicle on destruction.
  12. class CVehicleDamageBehaviorSpawnDebris
  13.         : public IVehicleDamageBehavior
  14. {
  15.         IMPLEMENT_VEHICLEOBJECT
  16. public:
  17.  
  18.         CVehicleDamageBehaviorSpawnDebris();
  19.         ~CVehicleDamageBehaviorSpawnDebris();
  20.  
  21.         virtual bool Init(IVehicle* pVehicle, const CVehicleParams& table) override;
  22.         virtual void Reset() override;
  23.         virtual void Release() override                                         { delete this; }
  24.  
  25.         virtual void Serialize(TSerialize ser, EEntityAspects aspects) override {}
  26.         virtual void Update(const float deltaTime) override;
  27.  
  28.         virtual void OnDamageEvent(EVehicleDamageBehaviorEvent event, const SVehicleDamageBehaviorEventParams& params) override;
  29.         virtual void OnVehicleEvent(EVehicleEvent event, const SVehicleEventParams& params) override;
  30.  
  31.         virtual void GetMemoryUsage(ICrySizer* s) const override;
  32.  
  33. protected:
  34.  
  35.         IEntity* SpawnDebris(IStatObj* pStatObj, Matrix34 vehicleTM, float force);
  36.         void     AttachParticleEffect(IEntity* pDetachedEntity);
  37.         void     GiveImpulse(IEntity* pDetachedEntity, float force);
  38.  
  39.         IVehicle* m_pVehicle;
  40.         string    m_particleEffect;
  41.  
  42.         typedef std::list<EntityId> TEntityIdList;
  43.         TEntityIdList m_spawnedDebris;
  44.  
  45.         struct SDebrisInfo
  46.         {
  47.                 CVehiclePartAnimated* pAnimatedPart;
  48.                 int                   jointId; // id of the joint in the intact model
  49.                 int                   slot;
  50.                 int                   index;
  51.                 EntityId              entityId;
  52.                 float                 time;
  53.                 float                 force;
  54.                 void                  GetMemoryUsage(class ICrySizer* pSizer) const {}
  55.         };
  56.  
  57.         typedef std::list<SDebrisInfo> TDebrisInfoList;
  58.         TDebrisInfoList m_debris;
  59.         bool            m_pickableDebris;
  60. };
  61.  
  62. #endif
  63.  
downloadVehicleDamageBehaviorSpawnDebris.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top