[DEV] add particule end detectuin and game element destroy call

This commit is contained in:
Edouard DUPIN 2013-09-16 21:10:02 +02:00
parent 9017472639
commit c5b072f457
4 changed files with 11 additions and 1 deletions

View File

@ -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) {};
};
};

View File

@ -209,6 +209,7 @@ void ege::Environement::RmElementGame(ege::ElementGame* _removeElement)
// ream remove on the element :
for (int32_t iii=0; iii<m_listElementGame.Size() ; iii++) {
if (_removeElement == m_listElementGame[iii]) {
m_listElementGame[iii]->OnDestroy();
m_listElementGame[iii]->DynamicDisable();
m_listElementGame[iii]->UnInit();
delete(m_listElementGame[iii]);

View File

@ -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) {};
};
};

View File

@ -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]);