feat: added npc poi for custom npcs
This commit is contained in:
@@ -10,6 +10,8 @@ void updateNPC(F32 delta, NPC *npc, World *world) {
|
||||
if(npc->waitTime > npc->maxWaitTime) {
|
||||
npc->mode = NPC_ACTION_WALKING;
|
||||
// TODO change targets to poi's rather than just random nodes
|
||||
// TODO choose either global POI's or use NPC custom poi if
|
||||
// customPOI is true
|
||||
do {
|
||||
npc->targetNavNode = Random_U32(&world->random, 0, world->navMesh->nodeCount);
|
||||
} while(npc->targetNavNode == npc->currentNavNode);
|
||||
@@ -23,7 +25,7 @@ void updateNPC(F32 delta, NPC *npc, World *world) {
|
||||
npc->walkTimer = 0;
|
||||
if(npc->path.nodeCount == npc->pathIndex+1){
|
||||
npc->mode = NPC_ACTION_WAITING;
|
||||
npc->maxWaitTime = Random_F32(&world->random, 1, 2);
|
||||
npc->maxWaitTime = Random_F32(&world->random, 20, 140);
|
||||
npc->waitTime = 0;
|
||||
npc->currentNavNode = npc->targetNavNode;
|
||||
npc->pathIndex = 0;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "npc_look.h"
|
||||
#include "../core/types.h"
|
||||
|
||||
#define NPC_SPEED 0.1f
|
||||
#define NPC_SPEED 1.0f
|
||||
|
||||
typedef enum NPC_ACTION NPC_ACTION;
|
||||
enum NPC_ACTION {
|
||||
@@ -23,6 +23,10 @@ struct NPC {
|
||||
Str8 name;
|
||||
NPC_LOOK look;
|
||||
|
||||
bool customPOI;
|
||||
U32 customPOICount;
|
||||
U32 npcPOI[16];
|
||||
|
||||
//// Actions
|
||||
NPC_ACTION mode;
|
||||
// How long they've been waiting
|
||||
|
||||
@@ -24,7 +24,7 @@ struct World {
|
||||
|
||||
//// NPCs
|
||||
U32 npcCount;
|
||||
NPC npcs[1024];
|
||||
NPC npcs[128];
|
||||
|
||||
////Bandit
|
||||
// The bandit the player is after.
|
||||
|
||||
Reference in New Issue
Block a user