feat: Player controller
This commit is contained in:
@@ -10,7 +10,9 @@ 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
|
||||
npc->targetNavNode = Random_U32(&world->random, 0, world->navMesh->nodeCount);
|
||||
do {
|
||||
npc->targetNavNode = Random_U32(&world->random, 0, world->navMesh->nodeCount);
|
||||
} while(npc->targetNavNode == npc->currentNavNode);
|
||||
npc->path = Nav_Path(world->navMesh, npc->currentNavNode, npc->targetNavNode);
|
||||
npc->walkTimer = 0;
|
||||
}
|
||||
@@ -21,7 +23,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, 10, 40);
|
||||
npc->maxWaitTime = Random_F32(&world->random, 1, 2);
|
||||
npc->waitTime = 0;
|
||||
npc->currentNavNode = npc->targetNavNode;
|
||||
npc->pathIndex = 0;
|
||||
|
||||
Reference in New Issue
Block a user