Add tower firing
This commit is contained in:
@@ -44,17 +44,22 @@ ecs_entity_t renderDebugPathSystem;
|
||||
|
||||
ECS_DTOR(SpatialGridID, gridID, {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
bzSpatialGridRemove(game->entityGrid, *gridID);
|
||||
if (*gridID != -1) {
|
||||
bzSpatialGridRemove(game->entityGrid, *gridID);
|
||||
*gridID = -1;
|
||||
}
|
||||
})
|
||||
ECS_MOVE(SpatialGridID, dst, src, {
|
||||
*dst = *src;
|
||||
*src = 0;
|
||||
*src = -1;
|
||||
})
|
||||
void spatialIDRemoved(ecs_iter_t *it) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
SpatialGridID *spatialID = ecs_field(it, SpatialGridID, 1);
|
||||
for (int i = 0; i < it->count; i++) {
|
||||
if (spatialID[i] == -1) continue;
|
||||
bzSpatialGridRemove(game->entityGrid, spatialID[i]);
|
||||
spatialID[i] = -1;
|
||||
}
|
||||
}
|
||||
ECS_DTOR(Path, path, {
|
||||
@@ -184,6 +189,7 @@ void setupSystems() {
|
||||
ECS_SYSTEM(ECS, updateAISystem, EcsOnUpdate, BzBTState);
|
||||
|
||||
ECS_SYSTEM(ECS, updateTower, EcsOnUpdate, Owner, Tower, Position, Size);
|
||||
ECS_SYSTEM(ECS, updateProjectile, EcsOnUpdate, Owner, Projectile, Position, Velocity);
|
||||
|
||||
ECS_SYSTEM(ECS, updateAnimationState, EcsOnUpdate, Animation, TextureRegion);
|
||||
ECS_SYSTEM(ECS, updateAnimation, EcsOnUpdate, Animation, TextureRegion);
|
||||
|
||||
Reference in New Issue
Block a user