Add static keyword to ease inout sine function

This commit is contained in:
2023-12-29 13:43:01 +01:00
parent 4c39e621fe
commit aa3bfbf823
6 changed files with 7 additions and 5 deletions

41
game/systems/s_ai.c Normal file
View File

@@ -0,0 +1,41 @@
#include "systems.h"
#include "game_state.h"
#include "unit_ai.h"
#include "unit_actions.h"
void handleUnitActionsSystem(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
UnitAction *action = ecs_field(it, UnitAction, 1);
for (i32 i = 0; i < it->count; i++) {
ecs_entity_t entity = it->entities[i];
handleAction(entity, &action[i], game);
}
}
void updateUnitAISystem(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
UnitAI *unitAI = ecs_field(it, UnitAI, 1);
UnitAction *action = ecs_field(it, UnitAction, 2);
for (i32 i = 0; i < it->count; i++) {
ecs_entity_t entity = it->entities[i];
Action *firstAction = action[i].first;
unitAI[i].action = firstAction;
updateUnitAI(entity, &unitAI[i], game);
}
}
void updateUnitActionsSystem(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
UnitAction *action = ecs_field(it, UnitAction, 1);
for (i32 i = 0; i < it->count; i++) {
ecs_entity_t entity = it->entities[i];
updateAction(&action[i], game);
}
}