public ObstacleVertex AddObstacle(VInt3 a, VInt3 b, VInt height) { ObstacleVertex obstacleVertex = new ObstacleVertex(); ObstacleVertex obstacleVertex2 = new ObstacleVertex(); obstacleVertex.prev = obstacleVertex2; obstacleVertex2.prev = obstacleVertex; obstacleVertex.next = obstacleVertex2; obstacleVertex2.next = obstacleVertex; obstacleVertex.position = a; obstacleVertex2.position = b; obstacleVertex.height = height; obstacleVertex2.height = height; obstacleVertex2.ignore = true; VInt2 vInt = new VInt2(b.x - a.x, b.z - a.z); vInt.Normalize(); obstacleVertex.dir = vInt; obstacleVertex2.dir = -vInt; if (this.Multithreading && this.doubleBuffering) { for (int i = 0; i < this.workers.Length; i++) { this.workers[i].WaitOne(); } } this.obstacles.Add(obstacleVertex); this.UpdateObstacles(); return(obstacleVertex); }
public ObstacleVertex AddObstacle(VInt3 a, VInt3 b, VInt height) { ObstacleVertex item = new ObstacleVertex(); ObstacleVertex vertex2 = new ObstacleVertex(); item.prev = vertex2; vertex2.prev = item; item.next = vertex2; vertex2.next = item; item.position = a; vertex2.position = b; item.height = height; vertex2.height = height; vertex2.ignore = true; VInt2 num = new VInt2(b.x - a.x, b.z - a.z); num.Normalize(); item.dir = num; vertex2.dir = -num; if (this.Multithreading && this.doubleBuffering) { for (int i = 0; i < this.workers.Length; i++) { this.workers[i].WaitOne(); } } this.obstacles.Add(item); this.UpdateObstacles(); return(item); }