Fix particle emitter not unloading on player death
parent
89176142b6
commit
34041a68bb
|
@ -151,12 +151,23 @@ collision_end:
|
||||||
|
|
||||||
void destroy_entity(Scene_t* scene, TileGrid_t* tilemap, Entity_t* p_ent)
|
void destroy_entity(Scene_t* scene, TileGrid_t* tilemap, Entity_t* p_ent)
|
||||||
{
|
{
|
||||||
|
/* Use the helper function to remove any entity
|
||||||
|
* This is because some components may have deinit steps
|
||||||
|
* This function will also take care of the tilemap collision handling
|
||||||
|
* */
|
||||||
|
|
||||||
Vector2 half_size = {0,0};
|
Vector2 half_size = {0,0};
|
||||||
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
||||||
if (p_bbox != NULL)
|
if (p_bbox != NULL)
|
||||||
{
|
{
|
||||||
half_size = p_bbox->half_size;
|
half_size = p_bbox->half_size;
|
||||||
}
|
}
|
||||||
|
CEmitter_t* p_emitter = get_component(p_ent, CEMITTER_T);
|
||||||
|
if (p_emitter != NULL)
|
||||||
|
{
|
||||||
|
unload_emitter_handle(&scene->part_sys, p_emitter->handle);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ent->m_tag == BOULDER_ENT_TAG)
|
if (p_ent->m_tag == BOULDER_ENT_TAG)
|
||||||
{
|
{
|
||||||
ParticleEmitter_t emitter = {
|
ParticleEmitter_t emitter = {
|
||||||
|
|
Loading…
Reference in New Issue