Move towards center when harvesting resources

This commit is contained in:
2024-02-13 13:24:28 +01:00
parent acebdceb6c
commit 2c0ceb026b
4 changed files with 10 additions and 8 deletions

View File

@@ -41,8 +41,8 @@ void setAIBehaviour(ecs_entity_t entity, const BzBTNode *root,
if (blackboard) {
AIBlackboard *b = ecs_get_mut(ECS, entity, AIBlackboard);
*b = *blackboard;
if (b->proximity < 4.0f)
b->proximity = 4.0f;
if (b->proximity < 2.0f)
b->proximity = 2.0f;
}
BzBTState *state = ecs_get_mut(ECS, entity, BzBTState);

View File

@@ -155,10 +155,10 @@ void inputUnitAction(Game *game, InputState *input) {
if (!hasNext) break;
Position target = *ecs_get(ECS, harvestEntity, Position);
HitBox targetHB = *ecs_get(ECS, harvestEntity, HitBox);
target = entityGetCenter(target, targetHB);
f32 proximity = 8.0f;
if (resource.type == RES_FOOD)
proximity = 2.0f;
f32 proximity = 4.0f;
Worker *worker = ecs_get_mut(ECS, entity, Worker);
worker->carryRes = resource.type;