protected void DrawLine2() { vectorLine.points3.Clear(); vectorLine.points3.Add(line2.Eval(-15)); vectorLine.points3.Add(line2.Eval(15)); vectorLine.Draw3D(); }
private void Draw() { if (LineMaterial_ == null) { Debugger.LogError("Not config Material!"); return; } string lineName = "boundary_line_created_time_" + Time.time; line_ = new VectorLine(lineName, LinePoints_, LineMaterial_, LineWidth_, LineType.Continuous, Joins.Weld); if (!VectorCanvas3D_) //----------第一次创建---------- { line_.Draw3D(); //先画 GameObject vectorCanvas = GameObject.Find("VectorCanvas"); //后找 Destroy(vectorCanvas); //用不到却生成了,删除之 VectorCanvas3D_ = GameObject.Find("VectorCanvas3D"); VectorCanvas3D_.layer = LayerMask.NameToLayer("Default"); } else { for (int i = VectorCanvas3D_.transform.childCount - 1; i >= 0; i--) { Destroy(VectorCanvas3D_.transform.GetChild(i).gameObject); //先删 } line_.Draw3D(); //后画 EnableVectorCanvas(true); } }
public void SetDraw() { string equal = "y="; if (A != 1) { equal += A.ToString(); } if (B != 0) { if (B > 0) { equal += "(x+" + B.ToString() + ")" + "<sup>2</sup>"; } else { equal += "(x" + B.ToString() + ")" + "<sup>2</sup>"; } } else { equal += "x<sup>2</sup>"; } if (C != 0) { if (C > 0) { equal += "+" + C.ToString(); } else { equal += C.ToString(); } } if (A == 0) { if (C > 0) { equal = "y=" + C.ToString(); } else { equal = "y=" + C.ToString(); } } MeshPro.SetText(equal); Grid.SetColor(colorGrid); Grid.Draw3D(); XOY_Line.SetColor(colorXOY); XOY_Line.endCap = "arrow"; XOY_Line.Draw3D(); // Spline.joins = Joins.Fill; Spline.SetColor(colorSpline); Spline.endCap = "arrow"; Spline.Draw3D(); }
public void SetOffset() { //spline.textureOffset = index; spline.SetColor(Color.red); // spline.joins = Joins.Weld; spline.Draw3D(); // index += 0.25f; }
public void SetColorGreen_Grid() { MaterialPlane.SetColor("_Color", Color.green); colorGrid = Color.white; colorXOY = Color.white; Grid.SetColor(colorGrid); Grid.Draw3D(); XOY_Line.SetColor(colorXOY); XOY_Line.endCap = "arrow"; XOY_Line.Draw3D(); }
void Start() { GridSize = GlobalVars.GridSize; VectorLine.SetCamera3D(GameObject.Find(VectrosityCamera)); LinePoints = new List<Vector3>(); // Init Stuff //CreateGridLines(); // Creating array of lines var myLine = new VectorLine(LineName, LinePoints, null, LineWidth); myLine.SetColor(Color.white); // Setting up the line myLine.Draw3D(); GameObject.Find(LineName).transform.position = new Vector3(0.5f, GridHeight, 0.5f); // Position Camera with the Grid CreateClickableTile(); }// Start
//画网格线 void DrawGridLine(string name, Vector3 posStart, Vector3 posEnd) { // Make Vector2 array; in this case we just use 2 elements... List <Vector3> linePoints = new List <Vector3>(); linePoints.Add(posStart); linePoints.Add(posEnd); // Make a VectorLine object using the above points and the default material, with a width of 2 pixels VectorLine line = new VectorLine(name, linePoints, lineWidth); line.Draw3D(); GameObject objLine = line.GetObj(); objLine.transform.parent = this.gameObject.transform; objLine.transform.localPosition = Vector3.zero; // Renderer rd = objLine.GetComponent<Renderer>(); // if (rd != null) // { // Debug.Log("line bound size= " + rd.bounds.size); // } Rigidbody2D bd = objLine.AddComponent <Rigidbody2D>(); bd.collisionDetectionMode = CollisionDetectionMode2D.Continuous; bd.bodyType = RigidbodyType2D.Static; listLine.Add(line); // bd.useGravity = false; }
void DrawSelectionLine(GameObject currentTarget) { Vector3 pos = currentTarget.transform.position; pos.z += 5; if (currentSelectionLine != null) { if (currentSelectionLine.points3.Count % 2 == 0) { // lineColors.Add (Color.white); } if (currentSelectionLine.points3.Count % 2 != 0) { currentSelectionLine.points3.Add(pos); if (lineColors != null) { lineColors.Add(Color.yellow); } } if (currentSelectionLine.points3.Count >= 2) { // Only draw when continuous, or when discrete && there are at least 2 points currentSelectionLine.points3[currentSelectionLine.points3.Count - 1] = pos; // currentSelectionLine.Draw(); currentSelectionLine.Draw3D(); } } }
/// <summary> /// 添加线 /// </summary> public void AddLine() { pathLine = new VectorLine("Path", new List<Vector3>(), lineTex, 3.0f, LineType.Continuous); pathLine.Draw3D();//不绘制一下无法设置父物体 pathLine.rectTransform.gameObject.transform.SetParent(lineContent); color = new Color(color.r, color.g, color.b, 0.7f); pathLine.color = color; pathLine.textureScale = 1.0f; pathIndex = 0; Renderer r = pathLine.rectTransform.gameObject.GetComponent<Renderer>(); //r.material.SetFloat("_InvFade", 0.15f);//原本是1,改为0.2,让线绘制的更加柔和,不会出现断裂 r.material.renderQueue = 4000;//默认透明度是3000,这里改为4000;让透明物体先渲染,该轨迹后渲染,效果会更好 lock (lines) { lines.Add(pathLine); if (lines.Count > limitLinesNum) { int removeNum = lines.Count - limitLinesNum; //lines.RemoveRange(0, removeNum); for (int i = 0; i < removeNum; i++) { Destroy(lines[0].rectTransform.gameObject); lines.RemoveAt(0); } } } }
void createArrows() { for (int i = 0; i < prevPositions.Count; i = i + 10) { Vector3 position = prevPositions [i]; Vector3 velocity = prevVelocities [i]; Vector3 right = new Vector3(1f, 0, 0); Vector3 up = new Vector3(0, 1f, 0); Vector3 forward = new Vector3(0, 0, 1f); Vector3 rightVelocity = Vector3.Project(velocity, right); Vector3 upVelocity = Vector3.Project(velocity, up); Vector3 forwardVelocity = Vector3.Project(velocity, forward); Vector3 final = position + Vector3.Normalize(velocity); Vector3 final1 = position + 2 * Vector3.Normalize(velocity); print("start: " + position); VectorLine.SetRay(Color.green, position, Vector3.Normalize(velocity)); var linePoints = new List <Vector3>() { final, final + new Vector3(0.5f, 0, 0), final1, final + new Vector3(-0.5f, 0, 0), final }; // C# var myLine = new VectorLine("Line", linePoints, 2.0f); myLine.Draw3D(); VectorLine.SetRay(Color.red, position, 0.1f * upVelocity); VectorLine.SetRay(Color.yellow, position, 0.1f * rightVelocity); VectorLine.SetRay(Color.blue, position, 0.1f * forwardVelocity); } }
void updateSelectedLine() { clearDisplayedLine(); int pointsCount = selectedBlocks.Count; if (pointsCount < 2) { if (pointsCount == 1) { addSelectionCirle(selectedBlocks[0].transform.position); } return; } Vector3[] points = new Vector3[selectedBlocks.Count]; for (int i = 0; i < pointsCount; ++i) { Vector3 pos = selectedBlocks[i].transform.position; pos.z = -5; points[i] = pos; addSelectionCirle(pos); } line = new VectorLine("LineRenderer", points, lineMaterial, 5.0f, Vectrosity.LineType.Continuous, Joins.Weld); line.endCap = "rounded"; line.Draw3D(); }
// Token: 0x06000B69 RID: 2921 RVA: 0x000347BC File Offset: 0x00032BBC private IEnumerator Start() { List <Vector3> splinePoints = new List <Vector3>(); int i = 1; object arg = "Sphere"; int num; i = (num = i) + 1; GameObject obj = GameObject.Find(arg + num); while (obj != null) { splinePoints.Add(obj.transform.position); object arg2 = "Sphere"; i = (num = i) + 1; obj = GameObject.Find(arg2 + num); } VectorLine line = new VectorLine("Spline", new List <Vector3>(this.segments + 1), 2f, LineType.Continuous); line.MakeSpline(splinePoints.ToArray(), this.segments, this.doLoop); line.Draw3D(); do { for (float dist = 0f; dist < 1f; dist += Time.deltaTime * this.speed) { this.cube.position = line.GetPoint3D01(dist); yield return(null); } }while (this.doLoop); yield break; }
IEnumerator Start() { var splinePoints = new List <Vector3>(); var i = 1; var obj = GameObject.Find("Sphere" + (i++)); while (obj != null) { splinePoints.Add(obj.transform.position); obj = GameObject.Find("Sphere" + (i++)); } var line = new VectorLine("Spline", new List <Vector3>(segments + 1), 2.0f, LineType.Continuous); line.MakeSpline(splinePoints.ToArray(), segments, doLoop); line.Draw3D(); // Make the cube "ride" the spline at a constant speed do { for (var dist = 0.0f; dist < 1.0f; dist += Time.deltaTime * speed) { cube.position = line.GetPoint3D01(dist); yield return(null); } } while (doLoop); }
void Aim() { RaycastHit2D hit = Physics2D.CircleCast(transform.position, hasBall ? 0.35f : 0.2f, transform.up, maxAimDistance, aimLayerMask); aimLine.points3[0] = transform.position; if (hit.collider != null) { aimLine.points3[1] = hit.point; float distanceLeft = maxAimDistance - hit.distance; Vector2 reflectedRay = Vector2.Reflect(transform.up, hit.normal); reflectedRay.Normalize(); RaycastHit2D secondHit = Physics2D.Raycast(hit.point + (reflectedRay * 0.1f), reflectedRay, distanceLeft, aimLayerMask); if (secondHit.collider != null) { aimLine.points3[2] = secondHit.point; } else { reflectedRay *= maxAimDistance - hit.distance; aimLine.points3[2] = hit.point + reflectedRay; } } else { aimLine.points3[1] = transform.position + (transform.up * maxAimDistance); aimLine.points3[2] = transform.position + (transform.up * maxAimDistance); } aimLine.Draw3D(); }
IEnumerator CO_Destroy() { if (b_DestroyHasStarted) { yield break; } b_DestroyHasStarted = true; Vector3 midPoint = (points[0] + points[1]) / 2; float i = 0.0f; Vector3 start = points[0]; Vector3 end = points[1]; Vector3 start2 = points[3]; Vector3 end2 = points[2]; while (i < 1.0f) { i += Time.deltaTime * f_InterpolateSpeed; myLine.points3[0] = Vector3.Lerp(start, midPoint, i); myLine.points3[1] = Vector3.Lerp(end, midPoint, i); myLine.points3[3] = Vector3.Lerp(start2, end2, i); myLine.Draw3D(); yield return(null); } yield return(null); //PVO_ClearCollider(); }
void Update() { // Change startIndex and endIndex over time, wrapping around as necessary startIndex += Time.deltaTime * speed; endIndex += Time.deltaTime * speed; if (startIndex >= segments + 1) { //do not wrap on lead in particle, destroy particle after one cycle //startIndex = -visibleLineSegments; //endIndex = 0; VectorLine.Destroy(ref line); Destroy(gameObject); return; } else if (startIndex < -visibleLineSegments) { startIndex = segments; endIndex = segments + visibleLineSegments; } line.drawStart = (int)startIndex; line.drawEnd = (int)endIndex; line.Draw3D(); }
private void Start() { List <Vector3> vector3List = new List <Vector3>(); int num1 = 1; int num2 = num1 + 1; // ISSUE: variable of a boxed type __Boxed <int> local = (ValueType)num1; for (GameObject gameObject = GameObject.Find("Sphere" + (object)local); Object.op_Inequality((Object)gameObject, (Object)null); gameObject = GameObject.Find("Sphere" + (object)num2++)) { vector3List.Add(gameObject.get_transform().get_position()); } if (this.usePoints) { VectorLine vectorLine = new VectorLine("Spline", new List <Vector3>(this.segments + 1), 2f, (LineType)2); vectorLine.MakeSpline(vector3List.ToArray(), this.segments, this.loop); vectorLine.Draw(); } else { VectorLine vectorLine = new VectorLine("Spline", new List <Vector3>(this.segments + 1), 2f, (LineType)0); vectorLine.MakeSpline(vector3List.ToArray(), this.segments, this.loop); vectorLine.Draw3D(); } }
void Start() { var splinePoints = new List <Vector3>(); var i = 1; var obj = GameObject.Find("Sphere" + (i++)); while (obj != null) { splinePoints.Add(obj.transform.position); obj = GameObject.Find("Sphere" + (i++)); } if (usePoints) { var dotLine = new VectorLine("Spline", new List <Vector3>(segments + 1), 2.0f, LineType.Points); dotLine.MakeSpline(splinePoints.ToArray(), segments, loop); dotLine.Draw(); } else { var spline = new VectorLine("Spline", new List <Vector3>(segments + 1), 2.0f, LineType.Continuous); spline.MakeSpline(splinePoints.ToArray(), segments, loop); spline.Draw3D(); } }
public static VectorLine CreateDottedLine(Vector3 start, Vector3 end) { var myline = new VectorLine("MyLine", new[] { start, end }, m_DottedLine, m_DottedLineThickness, LineType.Continuous); myline.SetTextureScale(1.0f); myline.Draw3D(); return(myline); }
private void Update() { /*for (int i = 1; i < _verts.Count; i++) * { * Debug.DrawLine(_tile.transform.position + _verts[i], _tile.transform.position + _verts[i - 1]); * }*/ line.Draw3D(); }
public override void ControlledUpdate() { if (!Running) { return; } GameTime += Time.deltaTime; Safeway.Draw3D(); if (EndPoint.position.y > 2) { //WIN StartCoroutine(Win()); return; } if (DistanceFromSafeway() > Safeway_Threshold / 20) { Lose(); } if (Application.isMobilePlatform) { Vector2 inacc = Input.acceleration; Control_Velocity = new Vector3(inacc.x * 2.2F, 0.0F, 0.0F); Control_Velocity.x = Mathf.Clamp(Control_Velocity.x, -1.3F, 1.3F); } else { if (Input.GetKey(KeyCode.A)) { Control_Velocity = new Vector3(-1, 0, 0); } else if (Input.GetKey(KeyCode.D)) { Control_Velocity = new Vector3(1, 0, 0); } else { Control_Velocity = Vector3.zero; } } Movement(); float tickrate = Mathf.Clamp(1.0F + MoveSpeed_actual / MoveSpeed, 1.1F, 3.0F); if (TargetGrand.Data.Fitness.Ratio < 1.0F) { TargetGrand.Data.Fitness.Add(FitnessPerTick * tickrate); } else { TargetGrand.Data.Fitness.AddMax(FitnessPerTick * tickrate / 5); } FitnessObj.Img[1].transform.localScale = new Vector3(TargetGrand.Data.Fitness.Ratio, 1, 1); }
// Use this for initialization void Start() { if (GetComponent <MeshFilter>() == null) { Destroy(this); } offset = Random.Range(0f, Mathf.PI); shape = new List <Vector3>(); if (shapeFile == null) { fromFile = false; r = GetComponent <MeshFilter>(); mesh = r.mesh; GetComponent <MeshRenderer>().enabled = false; foreach (Vector3 v in mesh.vertices) { shape.Add(v); } } else { fromFile = true; shape = VectorLine.BytesToVector3List(shapeFile.bytes); } line = new VectorLine(gameObject.name, shape, 0.5f, LineType.Continuous, Vectrosity.Joins.Weld); line.color = color; line.smoothWidth = true; line.smoothColor = true; for (int i = 0; i < shape.Count; i++) { if (!fromFile) { line.points3[i] = transform.TransformPoint(mesh.vertices[i]); } else { Vector3 newPoint = transform.TransformPoint(shape[i]); if (i % 2 == 0) { // newPoint = newPoint + Vector3.forward * Mathf.Sin(Time.time * 5f + (float)i/5f); } // newPoint = transform.TransformRotation(shape[i]); line.points3[i] = newPoint; if (i == 0) { // Debug.Log( transform.TransformPoint(shape[i])); } } } line.Draw3D(); }
void Start() { _vector = new VectorLine("beatcircle", new Vector3[10], Color.white, null, 1F, LineType.Continuous); _vector.MakeCircle(Vector3.zero, 0.01F); _vector.Draw3D(); _vector.vectorObject.transform.parent = transform; gameObject.AddComponent<Scale>(); }
void OnGUI() { if (!GetComponent <File>().IsBacklink&& inStraight != null && inter != null && outStraight != null) { inStraight.Draw3D(); inter.Draw3D(); outStraight.Draw3D(); } }
// Update is called once per frame void Update() { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { int k = (i * height) + j; //move points along z axis children[k].position = pos[k] + (Vector3.forward * 2 * Mathf.Sin(Time.time + (float)(j) / 2f + i / 2) * (float)j * 0.5f / (float)height); //move points along x axis children[k].position = pos[k] + (Vector3.right * 2 * Mathf.Sin(Time.time + i / 2f) * (float)j * 0.5f / (float)height); if (i >= folds[j].points3.Count) { folds[j].points3.Add(children[k].position); } else { folds[j].points3[i] = children[k].position; } if (i > 0 && i < width - 1) { if (j >= creases[i - 1].points3.Count) { creases[i - 1].points3.Add(children[k].position); } else { creases[i - 1].points3[j] = children[k].position; } if (j < height - 1) { float c = 1 - ((float)j / (float)height); creases[i - 1].SetColor(new Color(c, c, c), j); } } } } for (int j = 0; j < edge.Count; j++) { line.points3[j] = edge[j].position; } foreach (VectorLine v in creases) { v.Draw3D(); } foreach (VectorLine f in folds) { f.Draw3D(); } line.Draw3D(); }
// Update is called once per frame void Update() { if (!CircularSineWaveVis.enabled) { return; } data.UpdateData(); spline_.points3 = data.points; spline_.Draw3D(); }
public void UpdatePositions(List <Vector3> positions) { if (line != null) { //Debug.Log($"Line Pos: {line.rectTransform.rotation}, Rot: {line.rectTransform.position}"); line.points3 = positions; line.SetColor(lineColor); line.Draw3D(); } }
public static void DrawDottedLine(Vector3 position, float radius) { Vector3[] linePoints = new Vector3[segments + 1]; var myLine = new VectorLine("circle", linePoints, m_DottedLine, m_DottedLineThickness, LineType.Continuous); myLine.MakeCircle(position, radius); myLine.SetTextureScale(1.0f); myLine.Draw3D(); }
// Update is called once per frame void LateUpdate() { if (line != null && line.points3.Count > 0) { //line.drawTransform = display.transform; line.Draw3D(); // this is weird i know line2d.Draw3D(); } }
private void Draw3DLine(VectorLine line) { if (LocationHistoryManager.Instance.LineSetting.IsAuto) { line.Draw3DAuto();//点线多了 确实会影响性能 } else { line.Draw3D(); } }
void Update() { #if I_HAVE_VECTROSITY if (!Camera.main) { return; } //VectorLine.SetCamera3D(Camera.main); line.Draw3D(); #endif }
void Update () { var newPoint = GetMousePos(); // Mouse button clicked, so start a new line if (Input.GetMouseButtonDown (0)) { if (line3D) { line.points3.Clear(); line.Draw3D(); } else { line.points2.Clear(); line.Draw(); } previousPosition = Input.mousePosition; if (line3D) { line.points3.Add (newPoint); } else { line.points2.Add (newPoint); } canDraw = true; } // Mouse button held down and mouse has moved far enough to make a new point else if (Input.GetMouseButton (0) && (Input.mousePosition - previousPosition).sqrMagnitude > sqrMinPixelMove && canDraw) { previousPosition = Input.mousePosition; int pointCount; if (line3D) { line.points3.Add (newPoint); pointCount = line.points3.Count; line.Draw3D(); } else { line.points2.Add (newPoint); pointCount = line.points2.Count; line.Draw(); } if (pointCount >= maxPoints) { canDraw = false; } } }
public Circle(Vector3 origin, float radius, Color theColor, int theWidth) { segments = Mathf.Max((int)radius, MAX_SEGMENTS); vectorLine = new VectorLine("SelectCircle", new Vector3[segments * 2], theColor, null, theWidth); vectorLine.MakeCircle(origin, Vector3.up, radius, segments); prevPosition = origin; circleColor = theColor; this.radius = radius; vectorLine.Draw3D(); }
public void SetGeoList(Dictionary<string, List<Vector2>> list) { foreach (KeyValuePair<string, List<Vector2>> point in list) { List<Vector3> vertexes = new List<Vector3>(); List<Vector2> latlon = (List<Vector2>)point.Value; for (int i = 0; i < latlon.Count; i = i + 5) { Vector3 xyzpoint = XYZfromLatLon(latlon[i].y, latlon[i].x); vertexes.Add(xyzpoint); } VectorLine line = new VectorLine(point.Key, vertexes, lineMaterial.GetTexture(0), lineThickness, LineType.Continuous, Joins.Weld); line.material = lineMaterial; line.Draw3D(); lines.Add(line); } }
void DrawWall(Vector2[] room) { bool isClose = false; if(room[0] == room[room.Length-1]){ isClose = true; } if(isClose){ List<Vector2> outter; RoomQuad.GetPoint(room, true, out outter); List<Vector2> inner; RoomQuad.GetPoint(room, false, out inner); WallFill wallFill = new WallFill(VectorLine.canvas3D, "wallFill"); wallFill.Add(outter, inner); wallFill.Draw(); if(inner.Count > 0){ VectorLine roomInner = new VectorLine("RoomInner", inner, null, 1.0f, LineType.Continuous, Joins.Weld); roomInner.SetColor(Color.black); roomInner.Draw3D(); } if(outter.Count > 0){ VectorLine roomOutter = new VectorLine("RoomOutter", outter, null, 1.0f, LineType.Continuous, Joins.Weld); roomOutter.SetColor(Color.black); roomOutter.Draw3D(); } } else { Parallel parallel = new Parallel(); List<Vector2> outter = parallel.Execute(room, wallThick, false); List<Vector2> inner = parallel.Execute(room, wallThick, true); WallFill wallFill = new WallFill(VectorLine.canvas3D, "wallFill"); wallFill.Add(outter, inner); wallFill.Draw(); // if(inner.Count > 0){ // VectorLine roomInner = new VectorLine("RoomInner", inner, null, 1.0f, LineType.Continuous, Joins.None); // roomInner.SetColor(Color.black); // roomInner.Draw3D(); // } // // if(outter.Count > 0){ // VectorLine roomOutter = new VectorLine("RoomOutter", outter, null, 1.0f, LineType.Continuous, Joins.None); // roomOutter.SetColor(Color.black); // roomOutter.Draw3D(); // } // List<Vector3> outter; // bool counterClockwise = RoomQuad.GetPoint(room, isClose, true, out outter); // // int length = outter.Count-1; // // int startA = -1; // int startB = -1; // int endC = -1; // int endD = -1; // for(int i=0; i < length; i++){ // Vector2 dist = outter[i] - room[0]; // float wallThick = (float)RoomQuad.WallThick; // if(Mathf.Abs(dist.sqrMagnitude - wallThick/2*wallThick/2) < 0.001f){ // if(startA == -1){ // startA = i; // } // else{ // startB = i; // } // } // // dist = outter[i] - room[room.Length-1]; // if(Mathf.Abs(dist.sqrMagnitude - wallThick/2*wallThick/2) < 0.001f){ // if(endC == -1){ // endC = i; // } // else{ // endD = i; // } // } // } // // Debug.Log(string.Format("start index: ({0}, {1}), ", startA, startB)); // // Debug.Log("orientation: " + counterClockwise); // // List<Vector3> a = new List<Vector3>(); // List<Vector3> b = new List<Vector3>(); // // if(counterClockwise){ // // Vector3[] tmp = new Vector3[length+1]; // outter.CopyTo(0, tmp, 0, length); // //// if(length%2 == 1){ //// tmp[length] = tmp[length-1]; //// length++; //// } // // for(int i = startA; i > startA - length/2; i--){ // b.Add(tmp[(i+length)%length]); // } // // for(int i = startB; i < startB + length/2; i++){ // a.Add(tmp[i%length]); // } // // WallFill wallFill = new WallFill(VectorLine.canvas3D, "wallFill"); // wallFill.Draw(a, b); // } // if(outter.Count > 0){ // VectorLine roomInner = new VectorLine("RoomOutter", outter, null, 1.0f, LineType.Continuous, Joins.Weld); // roomInner.SetColor(Color.blue); // roomInner.Draw3D(); // } } }
public static void CreateVector(LevelBase m, List<Vector2> vecs) { VectorLine vecline; if (m.boundsVector != null) { DestroyImmediate(m.boundsVector); } vecs.Reverse(); //Vector2[] splinePoints = new Vector2[numberOfHills*2 + 1]; vecline = new VectorLine("Hills", // new Vector2[m.numberOfPoints], vecs.ToArray(), m.hillMaterial, m.width, LineType.Continuous, Joins.Weld); //vecline.useViewportCoords = true; // hills.collider = true; // vecline.MakeSpline( vecs.ToArray(), true ) ; vecline.Draw3D(); m.boundsVector = vecline.vectorObject; m.boundsVector.transform.parent = m.transform; m.boundsVector.layer = 0; GameObject vectorCam = GameObject.Find("VectorCam"); if (vectorCam != null) DestroyImmediate(vectorCam); }
public void renderEdges() { riverarray = new List<VectorLine>(); foreach (var p in map.centers) { foreach (var r in p.neighbors) { var edge = map.lookupEdgeFromCenter(p, r); Color32 colors; float width = 1; if (p.ocean != r.ocean) { // One side is ocean and the other side is land -- coastline width = 1; colors = displayColors["COAST"]; } else if ((p.water) != (r.water) && p.biome != "ICE" && r.biome != "ICE") { // Lake boundary width = 1; colors = displayColors["LAKESHORE"]; } else if (p.water || r.water) { continue; // Lake interior – we don't want to draw the rivers here } /* // The fissures looked goofy, so I changed the full poly to lava and we'll ring them with scorch. else if (lava.lava.ContainsKey(edge.index) && lava.lava[edge.index]) { width = 1; //GL.Color(displayColors["SCORCHED"]); } */ else if (edge.river > 0) { // River edge width = edge.river; colors = displayColors["RIVER"]; } else { continue; // No edge } var riverLine = new VectorLine("riverLine", new List<Vector3>() { new Vector3(edge.v0.point.x,edge.v0.point.y,-1f), new Vector3(edge.v1.point.x,edge.v1.point.y,-1f) }, width); riverLine.SetColor(colors); riverLine.Draw3D(); riverarray.Add(riverLine); } } }