Moved components initialisation outside of other components.
This commit is contained in:
parent
f13ad03d6e
commit
8a087f64fa
|
|
@ -43,14 +43,7 @@ inline int door_component_init(component_t *component)
|
||||||
}
|
}
|
||||||
component_data->hitbox_component_data = hitbox_component->data;
|
component_data->hitbox_component_data = hitbox_component->data;
|
||||||
|
|
||||||
animation_system_data_t *animation_system_data = component_data->animation_system_data;
|
|
||||||
|
|
||||||
animation_system_data->nb_frames = 8;
|
|
||||||
animation_system_data->frame_delay_ms = DOOR_DEFAULT_ANIMATION_SPEED;
|
|
||||||
if(animation_system_create_frames_clips(animation_system_data)) return EXIT_FAILURE;
|
|
||||||
|
|
||||||
component_data->topic_id = 0;
|
component_data->topic_id = 0;
|
||||||
|
|
||||||
event_bus_subscribe(&game.event_bus, component_data->topic_id, door_component_callback, component->entity);
|
event_bus_subscribe(&game.event_bus, component_data->topic_id, door_component_callback, component->entity);
|
||||||
|
|
||||||
component_data->state = false;
|
component_data->state = false;
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,7 @@ inline int lever_component_init(component_t *component)
|
||||||
}
|
}
|
||||||
component_data->animation_system_data = animation_system->data;
|
component_data->animation_system_data = animation_system->data;
|
||||||
|
|
||||||
animation_system_data_t *animation_system_data = component_data->animation_system_data;
|
|
||||||
|
|
||||||
animation_system_data->nb_frames = 3;
|
|
||||||
animation_system_data->frame_delay_ms = LEVER_DEFAULT_ANIMATION_SPEED;
|
|
||||||
if(animation_system_create_frames_clips(animation_system_data)) return EXIT_FAILURE;
|
|
||||||
|
|
||||||
component_data->topic_id = 0;
|
component_data->topic_id = 0;
|
||||||
|
|
||||||
event_bus_subscribe(&game.event_bus, component_data->topic_id, lever_component_callback, component->entity);
|
event_bus_subscribe(&game.event_bus, component_data->topic_id, lever_component_callback, component->entity);
|
||||||
|
|
||||||
component_data->state = false;
|
component_data->state = false;
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,6 @@ inline int player_system_init(component_t *component)
|
||||||
|
|
||||||
system_data->state = PLAYER_MOVING;
|
system_data->state = PLAYER_MOVING;
|
||||||
|
|
||||||
animation_system_data_t *animation_system_data = system_data->animation_system_data;
|
|
||||||
|
|
||||||
animation_system_data->loop = true;
|
|
||||||
animation_system_data->play = true;
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue