#ifndef PIXELDEFENSE_SYSTEMS_H #define PIXELDEFENSE_SYSTEMS_H #include #include "../components.h" #include "../ai_actions.h" typedef struct Game Game; /********************************** * Utils **********************************/ bool entitySetPath(const ecs_entity_t entity, const Vector2 target, Game *game); /********************************** * AI systems **********************************/ /* * 1. Harvestable */ void resetHarvestCount(ecs_iter_t *it); /* * 0: Game (singleton) * 1: BzBTState */ void updateAISystem(ecs_iter_t *it); void setAIBehaviour(ecs_entity_t entity, const BzBTNode *root, const AIBlackboard *blackboard); /********************************** * Animation Systems **********************************/ /* * 0: Game (singleton for Font) * 1: FloatyTextParticle */ void renderFloatyTextParticle(ecs_iter_t *it); /* * 1: ParticleEmitter */ void updateParticleEmitter(ecs_iter_t *it); bool updateParticle(const Texture2D tex, Particle *particle, f32 dt); Particle spawnParticle(const ParticleEmitter *emitter); void animationSetState(ecs_entity_t entity, Animation *anim, TextureRegion *texture, AnimType type, bool playInFull); /* * 1: Animation * 2: TextureRegion */ void updateAnimationState(ecs_iter_t *it); /* * 0: * 1: Animation * 2: TextureRegion */ void updateAnimation(ecs_iter_t *it); /* * 1: Easing */ void updateEasingSystem(ecs_iter_t *it); /********************************** * Entity Systems **********************************/ /* Observer (for removing TargetPosition) * 0: Game (singleton) for object pool * 1: Path */ void entityPathRemove(ecs_iter_t *it); void updateTextureOwnerTile(ecs_iter_t *it); /* Observer (for adding pop capacity) * 0: Game (singleton) * 1: AddPopCapacity * 2: Owner */ void buildingAddPopCapacity(ecs_iter_t *it); /* Observer (for removing pop capacity) * 0: Game (singleton) * 1: AddPopCapacity * 2: Owner */ void buildingRemovePopCapacity(ecs_iter_t *it); /* Observer (for consuming pop capacity) * 0: Game (singleton) * 1: ConsumePopCapacity */ void entityConsumePopCapacity(ecs_iter_t *it); /* Observer (for unconsuming pop capacity) * 0: Game (singleton) * 1: ConsumePopCapacity */ void entityUnConsumePopCapacity(ecs_iter_t *it); /* * 0: Game (singleton) for entity map * 1: Position * 2: HitBox * 3: Velocity (only entities with velocity change position) * 4: SpatialGridID */ void entityUpdateSpatialID(ecs_iter_t *it); /* * 1: Position * 2: Velocity * 3: Steering * 4: Unit */ void entityUpdateKinematic(ecs_iter_t *it); /* * Big system for updating physics and attacking * 0: Game (singleton) for collisions * 1: Position * 2: HitBox * 3: Velocity * 4: Unit * 5: Owner * 6: SpatialGridID */ void entityUpdate(ecs_iter_t *it); /* * 1: Position * 2: Velocity * 3: TargetPosition * 4: Steering */ void entityMoveToTarget(ecs_iter_t *it); /* * 0: Game (singleton) for object pool * 1: Path */ void entityFollowPath(ecs_iter_t *it); /* * 0: Game (singleton for spawning entities) * 1: Owner * 2: Building * 3: BuildingRecruitInfo */ void updateBuildingRecruitment(ecs_iter_t *it); /* * 0: Game (singleton for querying entities) * 1: Owner * 2: Tower * 3: Position * 4: Size */ void updateTower(ecs_iter_t *it); /* * 0: Game (singleton for querying entities) * 1: Owner * 2 Projectile * 3: Position * 4: Velocity */ void updateProjectile(ecs_iter_t *it); /* * 1: Position * 2: HitBox * 3: Health */ void renderHealthBar(ecs_iter_t *it); /* * 1: Position * 2: HitBox */ void renderColliders(ecs_iter_t *it); /* * 1: Position * 2: Orientation */ void renderOrientationDirection(ecs_iter_t *it); /* * 1: Path */ void renderDebugPath(ecs_iter_t *it); /********************************** * Event Systems **********************************/ void damageEvent(ecs_entity_t entity, DamageEvent event); i32 harvestEvent(ecs_entity_t entity, HarvestEvent event); void depositEvent(ecs_entity_t entity, DepositEvent event); /********************************** * Input systems **********************************/ /* * Task: * 0: Game (singleton) * 0: InputState (singleton) */ void updatePlayerInput(); /* * Task (rendering above ground): * 0: Game (singleton) * 0: InputState (singleton) */ void drawPlayerInputUIGround(); /* * Task (rendering on top): * 0: Game (singleton) * 0: InputState (singleton) */ void drawPlayerInputUI(); /********************************** * UI systems **********************************/ void drawGameUI(Game *game, f32 dt); void drawGameOverUI(Game *game, f32 dt); void drawPauseUI(Game *game, f32 dt); void drawMainMenuUI(Game *game, f32 dt); void drawSettingsUI(Game *game, f32 dt); /********************************** * Utils **********************************/ bool entityGetHitBox(ecs_entity_t entity, Position *outPos, Rectangle *outHitBox); Rectangle entityTransformHitBox(Position position, HitBox hitBox); Vector2 entityGetCenter(Position position, HitBox hitBox); /********************************** * MISC **********************************/ extern ecs_entity_t renderCollidersSystem; extern ecs_entity_t renderOrientDirSystem; extern ecs_entity_t renderDebugPathSystem; void setupSystems(); #endif //PIXELDEFENSE_SYSTEMS_H