diff --git a/ege/ElementGame.h b/ege/ElementGame.h index 8daeb0c..b5d54d5 100644 --- a/ege/ElementGame.h +++ b/ege/ElementGame.h @@ -287,6 +287,10 @@ namespace ege * @param[in] step : step of time in s */ virtual void IAAction(float _step) { }; + /** + * @brief, call when the element is removed (call only one time + */ + virtual void OnDestroy(void) {}; }; }; diff --git a/ege/Environement.cpp b/ege/Environement.cpp index ff634a0..98a91dd 100644 --- a/ege/Environement.cpp +++ b/ege/Environement.cpp @@ -209,6 +209,7 @@ void ege::Environement::RmElementGame(ege::ElementGame* _removeElement) // ream remove on the element : for (int32_t iii=0; iiiOnDestroy(); m_listElementGame[iii]->DynamicDisable(); m_listElementGame[iii]->UnInit(); delete(m_listElementGame[iii]); diff --git a/ege/Particule.h b/ege/Particule.h index b35b2a8..bab567f 100644 --- a/ege/Particule.h +++ b/ege/Particule.h @@ -26,7 +26,7 @@ namespace ege { */ class Particule { - private: + protected: ege::ParticuleEngine& m_particuleEngine; const char* m_particuleType; public: @@ -68,6 +68,10 @@ namespace ege { * @return Type of the current particule */ const char* GetParticuleType(void) { return m_particuleType; }; + /** + * @brief When the particule arrive to his end of life, this function is called. + */ + virtual void OnEnd(void) {}; }; }; diff --git a/ege/ParticuleEngine.cpp b/ege/ParticuleEngine.cpp index f272542..c7f0c22 100644 --- a/ege/ParticuleEngine.cpp +++ b/ege/ParticuleEngine.cpp @@ -93,6 +93,7 @@ void ege::ParticuleEngine::Update(float _deltaTime) continue; } if (m_particuleList[iii]->NeedRemove()) { + m_particuleList[iii]->OnEnd(); if (m_particuleList[iii]->GetParticuleType()==NULL) { // Real remove particule ... delete (m_particuleList[iii]);