Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jitter = Random.Range(0.1f, 0.4f);
- toCheck = 0.0f;
- THRESHOLD = 0.9f;
- THRES_DIRECTION = 1;
- if (direction == 1) {
- direction_vector.x -= jitter;
- toCheck = direction_vector.x;
- THRESHOLD *= -1;
- THRES_DIRECTION = -1;
- } else if (direction == 0) {
- direction_vector.y -= jitter;
- toCheck = direction_vector.y;
- THRESHOLD *= -1;
- THRES_DIRECTION = -1;
- } else if (direction == 2) {
- direction_vector.z -= jitter;
- toCheck = direction_vector.z;
- THRESHOLD *= -1;
- THRES_DIRECTION = -1;
- } else if (direction == 3) {
- direction_vector.x += jitter;
- toCheck = direction_vector.x;
- } else if (direction == 4) {
- direction_vector.y += jitter;
- toCheck = direction_vector.y;
- } else if (direction == 5) {
- direction_vector.z += jitter;
- toCheck = direction_vector.z;
- }
- switch (THRES_DIRECTION) {
- case -1:
- if (toCheck < THRESHOLD) {
- done = true;
- }
- break;
- case 1:
- if (toCheck > THRESHOLD) {
- done = true;
- }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement