Add static keyword to ease inout sine function
This commit is contained in:
41
game/systems/s_ai.c
Normal file
41
game/systems/s_ai.c
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user