We will create the function that computes the quality of the waypoint:
- Define the function with its parameters:
public static float GetCoverQuality( Vector3 location, int iterations, Vector3 characterSize, float radius, float randomRadius, float deltaAngle) { // next steps }
- Initialize the variable for handling the degrees of rotation, possible hits received, and valid visibility:
float theta = 0f; int hits = 0; int valid = 0;
- Start the main loop for the iterations to be computed on this waypoint and return the computed value:
for (int i = 0; i < iterations; i++) { // next steps } return (float)(hits / valid);
- Create a random position near the waypoint's origin to see whether the waypoint is easily reachable:
Vector3 ...