Implement harvest worker AI
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "input.h"
|
||||
#include "buildings.h"
|
||||
#include "pathfinding.h"
|
||||
#include "unit_ai.h"
|
||||
#include "unit_actions.h"
|
||||
|
||||
#include <rlImGui.h>
|
||||
#include <raymath.h>
|
||||
#include <rlgl.h>
|
||||
@@ -84,11 +87,17 @@ void inputUnitAction(Game *game, InputState *input) {
|
||||
for (i32 i = 0; i < it.count; i++) {
|
||||
const ecs_entity_t entity = it.entities[i];
|
||||
const Position target = *ecs_get(ECS, taskEntity, Position);
|
||||
addAction(entity, game, &(const Action) {
|
||||
.type = ACTION_MOVE_TO,
|
||||
.as.moveTo.target = target,
|
||||
.as.moveTo.proximityThreshold = 10.0f,
|
||||
setUnitAI(entity, game, &(const UnitAI) {
|
||||
.type = AI_WORKER_HARVEST,
|
||||
.as.workerHarvest.resource = RES_WOOD,
|
||||
.as.workerHarvest.target = taskEntity,
|
||||
.as.workerHarvest.targetPosition = target
|
||||
});
|
||||
//addAction(entity, game, &(const Action) {
|
||||
// .type = ACTION_MOVE_TO,
|
||||
// .as.moveTo.target = target,
|
||||
// .as.moveTo.proximityThreshold = 10.0f,
|
||||
//});
|
||||
//ecs_set(ECS, entity, HarvestTask, {taskEntity});
|
||||
goto while_break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user