public virtual void update_curve(Vector3f[] Vertices) { if (Vertices == null) { vectorLine.points3 = new List <Vector3>(); return; } if (vectorLine.points3.Count == Vertices.Length) { for (int i = 0; i < Vertices.Length; ++i) { vectorLine.points3[i] = Vertices[i]; } } else { //vectorLine.points3 = new List<Vector3>(Vertices.Length); vectorLine.points3.Clear(); for (int i = 0; i < Vertices.Length; ++i) { vectorLine.points3.Add(Vertices[i]); } } vectorLine.SetWidth(width); vectorLine.SetColor(color); }
void Update() { var oldPower = currentPower; // Move current power up or down, and choose a new target power when the current power reaches the target if (targetPower < currentPower) { currentPower -= speed * Time.deltaTime; if (currentPower < targetPower) { SetTargetPower(); } // When the bar decreases, use SetColor to "erase" the color from the current power to the old power bar.SetColor(Color.black, (int)Mathf.Lerp(0, segmentCount, currentPower), (int)Mathf.Lerp(0, segmentCount, oldPower)); } else { currentPower += speed * Time.deltaTime; if (currentPower > targetPower) { SetTargetPower(); } // When the bar increases, use SetColor to color the line segments from the old power to the current power bar.SetColor(Color.red, (int)Mathf.Lerp(0, segmentCount, oldPower), (int)Mathf.Lerp(0, segmentCount, currentPower)); } }
public void UpdateLine() { if (myLine != null) { myLine.drawStart = currentPoint; //Si el waypoint actual no es el final... if (followPoints.Count > 0) { //myLine = new VectorLine("Line", followPoints, 2.0f,LineType.Continuous,Joins.Weld); // C# myLine.MakeSpline(followPoints.ToArray(), followPoints.Count); if (_Data.userType == UserController.UserType.Azul) { myLine.SetColor(Color.blue); } if (_Data.userType == UserController.UserType.Amarillo) { myLine.SetColor(Color.yellow); } if (_Data.userType == UserController.UserType.Green) { myLine.SetColor(Color.green); } if (_Data.userType == UserController.UserType.Rojo) { myLine.SetColor(Color.red); } myLine.Draw(); } } }
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(); }
//Line methods public void InitLine() { if (myLine != null) { VectorLine.Destroy(ref myLine); } myLine = new VectorLine("Line", followPoints, lineWidth, LineType.Continuous, Joins.Weld); // C# if (_Data.userType == UserController.UserType.Azul) { myLine.SetColor(Color.blue); } if (_Data.userType == UserController.UserType.Amarillo) { myLine.SetColor(Color.yellow); } if (_Data.userType == UserController.UserType.Green) { myLine.SetColor(Color.green); } if (_Data.userType == UserController.UserType.Rojo) { myLine.SetColor(Color.red); } }
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(); }
protected void update(float newWidth, Colorf newColor) { if (width != newWidth) { vectorLine.SetWidth(newWidth); width = newWidth; } if (color != newColor) { vectorLine.SetColor(newColor); color = newColor; } }
public IEnumerator TreeGrowing() { //odd가 freeVertex가 아니였던거시다! //그러면 even이랑 odd가 tight가 됬으니 두 트리를 합치자! //이 경우 even이랑 odd는 사실 이미 tight인 상태! edge_info tt = new edge_info(select_even, select_odd, vert[select_even].position, vert[select_odd].position); //merge(select_even, select_odd); //odd가 freeVertex가 아니였다. //x는 이미 T에 속하니까 y랑 x`을 T에 추가하자. for (int i = 0; i < Match_edges.Count; ++i) { if (Match_edges[i].v2 == select_odd) { tree_vert[select_odd] = true; tree_vert[Match_edges[i].v1] = true; break; } } //선긋는 애니메이션 추가 Vector3[] t_V = { vert[select_even].position, vert[select_odd].position }; VectorLine VL = new VectorLine("tight_edges_" + (Tight_edges.Count + 1), t_V, linematerial, width, LineType.Continuous); VL.textureScale = 2f; VL.SetColor(t_color); VL.Draw(); tight_path.Add(VL); yield return(null); }
public override void OnButtonDown() { line = new VectorLine("Selection", new List <Vector2>(5), null, 1.0f, LineType.Continuous); line.capLength = 0.5f; line.SetColor(Color.white); originalPos = Input.mousePosition; }
void MakeGrid2() { List <Vector2> points2 = new List <Vector2>(); Rect realRect = DrawHelper.GetRealRect(camera2d); float xMin = realRect.xMin; float xMax = realRect.xMax; List <float> widths = new List <float>(); int startX = (int)xMin % gridUnit == 0? (int)xMin : ((int)xMin / gridUnit) * gridUnit; for (float x = startX; x <= xMax; x = x + gridUnit) { float pixelX = (x - xMin) / DrawHelper.Scale; points2.Add(new Vector2(pixelX, 0)); points2.Add(new Vector2(pixelX, camera2d.pixelHeight - 1)); if (Mathf.Approximately(x, 0)) { widths.Add(4.0f); } else { widths.Add(1.0f); } } float yMin = realRect.yMin; float yMax = realRect.yMax; int startY = (int)yMin % gridUnit == 0? (int)yMin : ((int)yMin / gridUnit) * gridUnit; for (float y = startY; y <= yMax; y = y + gridUnit) { float pixelY = (y - yMin) / DrawHelper.Scale; points2.Add(new Vector2(0, pixelY)); points2.Add(new Vector2(camera2d.pixelWidth - 1, pixelY)); if (Mathf.Approximately(y, 0)) { widths.Add(4.0f); } else { widths.Add(1.0f); } } gridLine.Resize(points2.Count); for (int i = 0; i < points2.Count; i++) { gridLine.points2[i] = points2[i]; } gridLine.SetWidths(widths); gridLine.SetColor(Color.gray); gridLine.Draw(); }
protected override void init() { line = new VectorLine(ToString(), new List <Vector2>(), null, 5.0f, LineType.Points); line.SetColor(Color.white); type = OperatingToolType.GISPoint; Reset(); }
private void colorGridLines() { for (int i = 0; i < numGridLines * 2; i++) { gridLines.SetColor(gridLineColors[gridLineOrder[i]], i); } }
void update_colors() { if (colors != null && colors.Length > 0) { if (points != null) { var ncolors = colors.Length; var needed = points.Length - 1; if (ncolors > needed) { Array.Resize(ref colors, needed); } else if (ncolors < needed) { Utils.Log("VectorsityLineRenderer[{}] Number of colors should be >= " + "points.Length-1. Expected {} or more got {}", name, points.Length - 1, colors.Length); colors = null; } } //Utils.Log("points {}, colors {}", points.Length, colors.Length);//debug line.SetColors(new List <Color32>(colors)); } else { line.SetColor(color); } }
void DrawMovePath() { if (movePathLines != null) { for (int i = 0; i < movePathLines.Count; i++) { VectorLine vl = movePathLines[i]; VectorLine.Destroy(ref vl); } } movePathLines = new List <VectorLine>(); for (int i = 0; i < movePath.Count; i++) { VectorLine vlo = new VectorLine("path", new List <Vector3>(5), null, 2.0f, LineType.Continuous); vlo.SetColor(tank.debugLineColor); vlo.MakeRect(Map.Instance.mapData[movePath[i].Key, movePath[i].Value].Pos + new Vector3(Map.Instance.cellSize / -2.0f, 0.11f, Map.Instance.cellSize / -2.0f), Map.Instance.mapData[movePath[i].Key, movePath[i].Value].Pos + new Vector3(Map.Instance.cellSize / 2.0f, 0.11f, Map.Instance.cellSize / 2.0f)); movePathLines.Add(vlo); } for (int i = 0; i < movePathLines.Count; i++) { movePathLines[i].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 DrawGridObstacles() { if (gridObstaclesLines != null) { for (int i = 0; i < gridObstaclesLines.Count; i++) { VectorLine vl = gridObstaclesLines[i]; VectorLine.Destroy(ref vl); } } gridObstaclesLines = new List <VectorLine>(); for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { if (mapData[row, col].Obstacle != null) { VectorLine vlo = new VectorLine("obs", new List <Vector3>(5), null, 2.0f, LineType.Continuous); vlo.SetColor(mapData[row, col].Obstacle.isBreakable ? Color.blue : Color.cyan); vlo.MakeRect(mapData[row, col].Pos + new Vector3(cellSize / -2.0f, 1.0f, cellSize / -2.0f), mapData[row, col].Pos + new Vector3(cellSize / 2.0f, 1.0f, cellSize / 2.0f)); gridObstaclesLines.Add(vlo); } } } for (int i = 0; i < gridObstaclesLines.Count; i++) { gridObstaclesLines[i].Draw3D(); } }
void RandomizeAllColors() { int maxSegment = line.GetSegmentNumber(); for (int i = 0; i < maxSegment; i++) { line.SetColor(new Color(Random.value, Random.value, Random.value), i); } }
/// <summary> /// 画圆 /// </summary> /// <param name="_vCenter"></param> void DrawCirc(Vector2 _vCenter) { VectorLine circleLine = new VectorLine("Circle", new Vector2[100], m_matCirc, 10.0f, LineType.Discrete, Joins.Weld); circleLine.MakeCircle(_vCenter, 5); circleLine.SetColor(Color.green); circleLine.Draw(); m_pLine.Add(circleLine); }
void AddGrid() { float rowCount = 12.0f; float colCount = 16.0f; float colStep = Screen.width / colCount; float rowStep = Screen.height / rowCount; // Debug.Log (colStep + " " + rowStep); // Debug.Log (Screen.width + " " + Screen.height); // // for (int i = 0; i < rowCount; i++) { // // // Vector2 a = new Vector2 (0, i * rowStep); // // Vector2 b = new Vector2 (Screen.width, i * rowStep); // // // Debug.DrawLine (a, b, Color.red); // // } // // // for (int j = 0; j < 16; j++) { // // Vector2 a = new Vector2 (j * colStep, 0); // Vector2 b = new Vector2 (j * colStep, Screen.height); // // Debug.DrawLine (a, b, Color.red); // } for (int i = 0; i < rowCount; i++) { Vector2 a = new Vector2 (0, i * rowStep); Vector2 b = new Vector2 (Screen.width, i * rowStep); VectorLine line = new VectorLine ("row" + i, new Vector2[]{a,b}, null, 1.0f); line.SetColor (Color.green); line.Draw (); } for (int j = 0; j < 16; j++) { Vector2 a = new Vector2 (j * colStep, 0); Vector2 b = new Vector2 (j * colStep, Screen.height); VectorLine line = new VectorLine ("col" + j, new Vector2[]{a,b}, null, 1.0f); line.SetColor (Color.green); line.Draw (); } }
/// <summary> /// 绘制矩形 /// </summary> private void CreateRect(float posX, float posY, float width, float height, Color color) { VectorLine squareLine = new VectorLine ("Square", new Vector2[8], null, 1.0f, LineType.Discrete, Joins.Weld); squareLine.MakeRect (new Rect (posX, posY, width, height)); squareLine.SetColor (color); squareLine.Draw (); }
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(); } }
/// <summary> /// 绘制矩形 /// </summary> private void CreateRect(float posX, float posY, float width, float height, Color color) { VectorLine squareLine = new VectorLine("Square", new Vector2[8], null, 1.0f, LineType.Discrete, Joins.Weld); squareLine.MakeRect(new Rect(posX, posY, width, height)); squareLine.SetColor(color); squareLine.Draw(); }
public void drawTargetFunction() { for (int i = 0; i <= numPoints - 1; i++) { float newPointX = ((float)i / (float)(numPoints - 1f)); float newPointY = functionEvaluate(newPointX); targetFunctionLine.points2.Add(new Vector2(functionsOrigin.x + newPointX * functionsScale.x, functionsOrigin.y + newPointY * functionsScale.y)); } targetFunctionLine.Draw(); targetFunctionLine.SetColor(Color.blue); }
void Start() { arrow = new VectorLine("Arrow", new Vector3[2], LineMaterial, LineThickness); // Set the end cap of the arrow. VectorLine.SetEndCap("ArrowEndCap", EndCap.Front, LineMaterial, -1.0f, ArrowEndCap); arrow.endCap = "ArrowEndCap"; // Set arrow style: arrow.textureScale = TextureScale; arrow.SetColor(ArrowColor); }
public IEnumerator pulseColor(Color newColor, float pulseTime, float thickness, bool right) //sus { for (float time = 0f; time <= pulseTime; time += Time.deltaTime) { float ratio = right ? time / pulseTime : (pulseTime - time) / pulseTime; int segments = (originalPoints.Count - 1); int center = (int)(ratio * segments); int interval = (int)(thickness * segments); visualLine.SetColor(lineColor); for (int i = center - interval / 2; i <= center + interval / 2; i++) { if (i >= 0 && i < segments) { float colorRatio = (float)Mathf.Abs(i - center) / (interval / 2); visualLine.SetColor(newColor * (1 - colorRatio) + lineColor * (colorRatio), i); } } yield return(null); } visualLine.SetColor(lineColor); }
public void drawNNFunction() { NNFunctionLine.points2.Clear(); for (int i = 0; i < numPoints; i++) { float newPointX = ((float)i / (float)(numPoints - 1)); float newPointY = (float)bestNet.FeedForward(new double[] { newPointX })[0]; NNFunctionLine.points2.Add(new Vector2(functionsOrigin.x + newPointX * functionsScale.x, functionsOrigin.y + newPointY * functionsScale.y)); } NNFunctionLine.Draw(); NNFunctionLine.SetColor(Color.red); updateNNOutput(); }
private bool UpdateLineWithSegments() { var doUpdate = false; for (int i = 0; i < segments.Count; i++) { if (!Colors32Equal(vline.GetColor(i), segments[i].color)) { vline.SetColor(segments[i].color, i); doUpdate = true; } if (vline.GetWidth(i) != segments[i].width) { vline.SetWidth(segments[i].width, i); doUpdate = true; } } if (doUpdate) { UpdateLine(); return(true); } return(false); }
public void CreatedSplineCurrent() { // spline_Current_Points.Clear(); // Spline_Current.points3.Clear(); // spline_Current_Points = enterArray; Spline_Current.SetColor(colorSpline_Current); Spline_Current.endCap = "arrow"; Spline_Current.Draw3D(); var splain = GameObject.Find("Spline_Current"); var controller = GameObject.Find("Controller"); splain.transform.parent = controller.transform; splain.transform.localEulerAngles = new Vector3(0, 0, 0); splain.transform.localPosition = new Vector3(0, 0, -0.01f); }
// Update is called once per frame void Update() { if (transform.position.z > 200) { //blank out title when banner is inverted if (transform.eulerAngles.x < 180) { line.color = colorNormal; } else { line.SetColor(Color.clear, 0, 30); } //translate title banner through world space towards the player at 1 meter per second * 240 transform.Translate(Vector3.back * Time.deltaTime * 240, Space.World); //rotate title banner around its local X axis at 1 degreee per second * 240 transform.Rotate(Vector3.left * Time.deltaTime * 360); //set color lerp start time starttime = Time.time; } else { //lerp color //var myLerp = Mathf.Lerp(0, 1, (Time.time - starttime) / duration); //var c = Color.Lerp(color1, color2, myLerp); var c = (MathS.ColorLerp(color1, color2, (Time.time - starttime) / duration)); line.color = c; //invert colors if (c == color2) { if (toggle) { toggle = !toggle; color1 = colorNormal; color2 = colorIntense; } else { toggle = !toggle; color1 = colorIntense; color2 = colorNormal; } starttime = Time.time; } } }
// Use this for initialization void Start() { if(!name.Contains("Circle")){ myLine = new VectorLine("myLine",new Vector3[]{ transform.position, nextObject.transform.position}, mat, 5f); myLine.vectorObject.transform.parent = transform.parent.parent; myLine.SetColor( GameObject.Find("Drawer").GetComponent<Renderer>().material.color); // DrawLine.Instance.SetLineCollider(transform.position, nextObject.transform.position, gameObject); } else{ Vector3[] linePoints = new Vector3[60+1]; nextObject = gameObject; myLine = new VectorLine("Circle", linePoints, null, 5f, LineType.Continuous, Joins.Weld); myLine.vectorObject.transform.parent = transform.parent; myLine.SetColor( GameObject.Find("Drawer").GetComponent<Renderer>().material.color); transform.localScale = Vector3.one * radius*2; } }
void Update() { if (Input.GetMouseButtonDown(0)) { StopCoroutine("CycleColor"); selectionLine.SetColor(Color.white); originalPos = Input.mousePosition; } if (Input.GetMouseButton(0)) { selectionLine.MakeRect(originalPos, Input.mousePosition); selectionLine.Draw(); } if (Input.GetMouseButtonUp(0)) { StartCoroutine("CycleColor"); } }
private void drawFitnessHistory() { fitnessRecord.Add((float)bestNet.Fitness()); fitnessHistoryLine.points2.Clear(); fitnessHistoryXStep = fitnessHistoryScale.x / ((float)fitnessRecord.Count - 1); for (int i = 0; i < fitnessRecord.Count; i++) { float newPointX = fitnessHistoryOrigin.x + (float)i * fitnessHistoryXStep; float newPointY = fitnessHistoryOrigin.y + (fitnessRecord[i] + bestNet.numOutputs) * fitnessHistoryScale.y; fitnessHistoryLine.points2.Add(new Vector2(newPointX, newPointY)); } if (fitnessHistoryLine.points2.Count >= 2) { fitnessHistoryLine.Draw(); fitnessHistoryLine.SetColor(Color.green); } }
IEnumerator EaseOut(VectorLine vectorLine, Color endColor) { var elapsed = 0F; while (elapsed <= EaseDuration) { var c = Color.Lerp(StartColor, endColor, elapsed/EaseDuration); elapsed += Time.deltaTime; vectorLine.SetColor(c); yield return null; } for (var i = 1; i <= 20; ++i) { var v0 = Vector3.Lerp(vectorLine.points3[0], vectorLine.points3[1], (float)(i-1) / 10); var v1 = Vector3.Lerp(vectorLine.points3[0], vectorLine.points3[1], (float)i / 10); FragManager.Instance.Make(v0, v1, endColor); } vectorLine.vectorObject.SetActive(false); _pool.Enqueue(vectorLine); }
protected override void init() { msh = new Mesh(); vertices2D = new List <Vector2>(); var g = new GameObject(Time.deltaTime.ToString()); g.AddComponent(typeof(MeshRenderer)); MeshFilter filter = g.AddComponent(typeof(MeshFilter)) as MeshFilter; g.GetComponent <MeshRenderer>().material.color = Color.green; g.transform.parent = GisWrapper.polygonParent.transform; type = OperatingToolType.GISPolygon; filter.mesh = msh; line = new VectorLine(ToString(), new List <Vector2>(), null, 1.0f, LineType.Continuous); line.SetColor(Color.white); Reset(); }
void Start () { //VectorLine.SetCamera3D(); //Vector2[] linePoints = {new Vector2(0,0),new Vector2(1,1)}; //VectorLine myline = new VectorLine.SetLine(Color.green, new Vector2(0, 0), new Vector2(1, 1)); Vector2[] linePoints = { new Vector2(0, 0),new Vector2(1, 1)}; Material line = (Material)Resources.Load("Line"); VectorLine myline = new VectorLine("MyLine",linePoints,null,0.05f,LineType.Continuous); //VectorLine.SetCanvasCamera (Camera.main); //c.re Rect r = new Rect(0,0,2,1); //myline.make myline.MakeRoundedRect(r, 0.2f,10); myline.SetColor(Color.black); myline.Draw(); }
//Line methods public void InitLine(){ if (myLine != null) { VectorLine.Destroy(ref myLine); } myLine = new VectorLine("Line", followPoints, lineWidth,LineType.Continuous,Joins.Weld); // C# if(_Data.userType == UserController.UserType.Azul)myLine.SetColor (Color.blue); if(_Data.userType == UserController.UserType.Amarillo)myLine.SetColor (Color.yellow); if(_Data.userType == UserController.UserType.Green)myLine.SetColor (Color.green); if(_Data.userType == UserController.UserType.Rojo)myLine.SetColor (Color.red); }
/// <summary> /// 画出网格 /// </summary> public void DrawGrid() { for (int i = 0; i <= MAX_ROW; i++) { Vector2 a = new Vector2 (0, Screen.height - i * rowStep); Vector2 b = new Vector2 (Screen.width, Screen.height - i * rowStep); VectorLine line = new VectorLine ("row" + i, new Vector2[]{a,b}, null, 1.0f); line.SetColor (Color.red); line.Draw (); } for (int j = 0; j <=MAX_COL; j++) { Vector2 a = new Vector2 (j * colStep, 0); Vector2 b = new Vector2 (j * colStep, Screen.height); VectorLine line = new VectorLine ("col" + j, new Vector2[]{a,b}, null, 1.0f); line.SetColor (Color.red); line.Draw (); } }
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(); // } } }
// void OnGUI() // { // if(draw_mode) // { // Vector3 spot_on_screen = Camera.main.WorldToScreenPoint (transform.position); //// GUI.DrawTexture(new Rect(spot_on_screen.x - 100, Screen.height - spot_on_screen.y - 15, 200,30), // GUI.Label(new Rect(spot_on_screen.x - 100, Screen.height - spot_on_screen.y - 15, 200,30), // display_text, // enginePlayerS.hover_text); // } // // } void createBorder() { border = pathDrawS.outlineHex(hex_data); border.SetColor(enginePlayerS.select_color); glow = pathDrawS.outlineHex(hex_data); glow.lineWidth = border.lineWidth * 1.75F; glow.SetColor(enginePlayerS.glow_color); }
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); } } }