Move system initialization in systems.c, properly delete all entities when unloading map

This commit is contained in:
2023-12-29 17:18:06 +01:00
parent 5190c86316
commit cc66f15131
8 changed files with 84 additions and 82 deletions

View File

@@ -163,29 +163,9 @@ void drawPlayerInputUI();
* MISC
**********************************/
static void setupSystems(ecs_world_t *ecs) {
extern ecs_entity_t renderCollidersSystem;
extern ecs_entity_t renderDebugPathSystem;
ECS_OBSERVER(ecs, entityPathRemove, EcsOnRemove, Path);
ECS_SYSTEM(ecs, entityUpdateSpatialID, EcsOnUpdate, Position, Size, Velocity, SpatialGridID);
ECS_SYSTEM(ecs, entityUpdateKinematic, EcsOnUpdate, Position, Rotation, Velocity, Steering);
ECS_SYSTEM(ecs, entityMoveToTarget, EcsOnUpdate, Position, Rotation, Velocity, TargetPosition, Steering);
ECS_SYSTEM(ecs, entityFollowPath, EcsOnUpdate, Path);
ECS_SYSTEM(ecs, handleUnitActionsSystem, EcsOnUpdate, UnitAction);
ECS_SYSTEM(ecs, updateUnitAISystem, EcsOnUpdate, UnitAI, UnitAction);
// Needs to be called after AI update, since it removes finished actions
ECS_SYSTEM(ecs, updateUnitActionsSystem, EcsOnUpdate, UnitAction);
ECS_SYSTEM(ecs, updateAnimationState, EcsOnUpdate, Animation, TextureRegion);
ECS_SYSTEM(ecs, updateAnimation, EcsOnUpdate, Animation, TextureRegion);
ECS_SYSTEM(ecs, updateEasingSystem, EcsOnUpdate, Easing, Position, Size, Rotation);
ECS_SYSTEM(ecs, renderDebugPath, EcsOnUpdate, Path);
ECS_SYSTEM(ecs, renderColliders, EcsOnUpdate, Position, Size);
ECS_SYSTEM(ecs, renderRotationDirection, EcsOnUpdate, Position, Rotation);
}
void setupSystems();
#endif //PIXELDEFENSE_SYSTEMS_H