protected override void OnStateUpdate(AIBehaviour aiBehaviour) { if (navMeshMovement != null && followObject != null) { navMeshMovement.speed = speed; navMeshMovement.MoveToDestination(followObject.transform.position, stoppingDistance); } }
protected override void OnStateUpdate(AIBehaviour aiBehaviour) { if (navMeshMovement != null && aiPath != null) { navMeshMovement.speed = speed; if (navMeshMovement.remainingDistance <= changePointThreshold) { if (aiPath.isPathClosed) { currentPathIndex++; if (currentPathIndex >= aiPath.numPoints) { currentPathIndex = 0; } } else { if (pathPendingDown) { currentPathIndex--; if (currentPathIndex < 0) { currentPathIndex = 0; pathPendingDown = false; } } else { currentPathIndex++; if (currentPathIndex >= aiPath.numPoints) { currentPathIndex = aiPath.numPoints - 1; pathPendingDown = true; } } } } navMeshMovement.MoveToDestination(aiPath[currentPathIndex]); } }