private void LinesUpdate() { //Update all our drawing lines currentMoveLine.points3[0] = Vector3.up + transform.position; currentMoveLine.points3[1] = Vector3.up + transform.position + (transform.forward * speed); currentMoveLine.points3[2] = Vector3.up + transform.position + (transform.forward * maxSpeed); //float dot = Vector3.Dot(head.forward, transform.forward); //float dotNormalised = (dot + 1f) / 2f; //should b 1 = same direction, 0 = opposite direction //float aimLengthFactor = dotNormalised.Clamp(1f, 0.5f); float aimLengthFactor = 1f; aimLine.points3[0] = actionPoint.position; aimLine.points3[1] = actionPoint.position + (aimingVector * aimLengthFactor * 4f); aimMinLine.MakeCircle(transform.position, Vector3.up, aimMin); aimMaxLine.MakeCircle(transform.position, Vector3.up, aimMax); moveTriggerLine.MakeCircle(transform.position, Vector3.up, moveTriggerRange); ////debug lines around aiming //if (showDebug) //{ // aimMinLine.color = Color.blue; // aimMaxLine.color = Color.blue; // moveTriggerLine.color = Color.blue; //} //else //{ // aimMinLine.color = Color.clear; // aimMaxLine.color = Color.clear; // moveTriggerLine.color = Color.clear; //} }
// Token: 0x06000B35 RID: 2869 RVA: 0x00032F28 File Offset: 0x00031328 private void Start() { VectorLine vectorLine = new VectorLine("OrbitLine", new List <Vector3>(this.orbitLineResolution), 2f, LineType.Continuous); vectorLine.material = this.lineMaterial; vectorLine.MakeCircle(Vector3.zero, Vector3.up, Vector3.Distance(base.transform.position, Vector3.zero)); vectorLine.Draw3DAuto(); }
private void Start() { VectorLine vectorLine = new VectorLine("OrbitLine", new List <Vector3>(this.orbitLineResolution), 2f, (LineType)0); vectorLine.set_material(this.lineMaterial); vectorLine.MakeCircle(Vector3.get_zero(), Vector3.get_up(), Vector3.Distance(((Component)this).get_transform().get_position(), Vector3.get_zero())); vectorLine.Draw3DAuto(); }
public Material lineMaterial; // This should be a material with a shader that will draw on top of the stars void Start() { var orbitLine = new VectorLine("OrbitLine", new List <Vector3>(orbitLineResolution), 2.0f, LineType.Continuous); orbitLine.material = lineMaterial; orbitLine.MakeCircle(Vector3.zero, Vector3.up, Vector3.Distance(transform.position, Vector3.zero)); orbitLine.Draw3DAuto(); }
/// <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 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>(); }
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(); }
private void Start() { this.position = new Vector2(this.radius + 20f, (float)Screen.get_height() - (this.radius + 20f)); VectorLine vectorLine = new VectorLine("BarBackground", new List <Vector2>(50), (Texture)null, (float)this.lineWidth, (LineType)0, (Joins)1); vectorLine.MakeCircle(Vector2.op_Implicit(this.position), this.radius); vectorLine.Draw(); this.bar = new VectorLine("TotalBar", new List <Vector2>(this.segmentCount + 1), (Texture)null, (float)(this.lineWidth - 4), (LineType)0, (Joins)1); this.bar.set_color(Color32.op_Implicit(Color.get_black())); this.bar.MakeArc(Vector2.op_Implicit(this.position), this.radius, this.radius, 0.0f, 270f); this.bar.Draw(); this.currentPower = Random.get_value(); this.SetTargetPower(); this.bar.SetColor(Color32.op_Implicit(Color.get_red()), 0, (int)Mathf.Lerp(0.0f, (float)this.segmentCount, this.currentPower)); }
private void setupRing(string id, Vector3 upVector) { var ring = new VectorLine(id, new List <Vector3>(ringVertices), ringWidth, LineType.Continuous, Joins.Weld); ring.material = lineMaterial; ring.MakeCircle(Vector3.zero, upVector, ringRadius); // ring.Draw3DAuto(); GameObject container = new GameObject(id); container.transform.parent = transform; container.transform.localPosition = Vector3.zero; VectorManager.useDraw3D = true; VectorManager.ObjectSetup(container, ring, Visibility.Always, Brightness.None); }
// Token: 0x06000B45 RID: 2885 RVA: 0x00033680 File Offset: 0x00031A80 private void Start() { this.position = new Vector2(this.radius + 20f, (float)Screen.height - (this.radius + 20f)); VectorLine vectorLine = new VectorLine("BarBackground", new List <Vector2>(50), null, (float)this.lineWidth, LineType.Continuous, Joins.Weld); vectorLine.MakeCircle(this.position, this.radius); vectorLine.Draw(); this.bar = new VectorLine("TotalBar", new List <Vector2>(this.segmentCount + 1), null, (float)(this.lineWidth - 4), LineType.Continuous, Joins.Weld); this.bar.color = Color.black; this.bar.MakeArc(this.position, this.radius, this.radius, 0f, 270f); this.bar.Draw(); this.currentPower = UnityEngine.Random.value; this.SetTargetPower(); this.bar.SetColor(Color.red, 0, (int)Mathf.Lerp(0f, (float)this.segmentCount, this.currentPower)); }
void addSelectionCirle(Vector3 position) { int segments = 6; // Make Vector2 array where the size is the number of segments plus one (since the first and last points must be the same) var linePoints = new Vector3[segments + 1]; // Make a VectorLine object using the above points and a material as defined in the inspector, with a width of 3 pixels var l = new VectorLine("Dots", linePoints, lineMaterial, 6.0f, Vectrosity.LineType.Continuous, Joins.Weld); // Create an ellipse in the VectorLine object, where the origin is the center of the screen // If xRadius and yRadius are the same, you can use MakeCircleInLine instead, which needs just one radius value instead of two l.MakeCircle(position, 0.015f);// MakeEllipse(Vector2(Screen.width / 2, Screen.height / 2), xRadius, yRadius, segments, pointRotation); // Draw the line l.Draw3D(); selectionCircles.Add(l); }
void newSelectedUnit(RaycastHit2D playerUnit) { selected = playerUnit.transform.gameObject; CircleCollider2D collider = selected.GetComponentInChildren <CircleCollider2D>(); selectedRadius = collider.radius; selectedPos = collider.transform.position; selectCircle.MakeCircle(selectedPos, selectedRadius, 360); selectCircle.active = true; if (destinationCircle.active == true) { destinationCircle.active = false; } if (movePathLine.active == true) { movePathLine.active = false; } }
void Start() { position = new Vector2(radius + 20, Screen.height - (radius + 20)); // Set up a white circle for the background of the power bar var circle = new VectorLine("BarBackground", new List <Vector2>(50), null, lineWidth, LineType.Continuous, Joins.Weld); circle.MakeCircle(position, radius); circle.Draw(); // Make the power bar by drawing a 270° arc bar = new VectorLine("TotalBar", new List <Vector2>(segmentCount + 1), null, lineWidth - 4, LineType.Continuous, Joins.Weld); bar.color = Color.black; bar.MakeArc(position, radius, radius, 0.0f, 270.0f); bar.Draw(); currentPower = Random.value; SetTargetPower(); // Set the initial bar colors by coloring the segments from the beginning to the current power level bar.SetColor(Color.red, 0, (int)Mathf.Lerp(0, segmentCount, currentPower)); }
// Token: 0x06000B43 RID: 2883 RVA: 0x00033550 File Offset: 0x00031950 private void Start() { int num = this.numberOfDots * this.numberOfRings; Vector2[] collection = new Vector2[num]; Color32[] array = new Color32[num]; float b = 1f - 0.75f / (float)num; for (int i = 0; i < array.Length; i++) { array[i] = this.dotColor; this.dotColor *= b; } VectorLine vectorLine = new VectorLine("Dots", new List <Vector2>(collection), this.dotSize, LineType.Points); vectorLine.SetColors(new List <Color32>(array)); for (int j = 0; j < this.numberOfRings; j++) { vectorLine.MakeCircle(new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)), (float)(Screen.height / (j + 2)), this.numberOfDots, this.numberOfDots * j); } vectorLine.Draw(); }
void Start() { var totalDots = numberOfDots * numberOfRings; var dotPoints = new Vector2[totalDots]; var dotColors = new Color32[totalDots]; var reduceAmount = 1.0f - .75f / totalDots; for (int i = 0; i < dotColors.Length; i++) { dotColors[i] = dotColor; dotColor *= reduceAmount; } var dots = new VectorLine("Dots", new List <Vector2>(dotPoints), dotSize, LineType.Points); dots.SetColors(new List <Color32>(dotColors)); for (int i = 0; i < numberOfRings; i++) { dots.MakeCircle(new Vector2(Screen.width / 2, Screen.height / 2), Screen.height / (i + 2), numberOfDots, numberOfDots * i); } dots.Draw(); }
private void Start() { int length = this.numberOfDots * this.numberOfRings; Vector2[] vector2Array = new Vector2[length]; Color32[] color32Array = new Color32[length]; float num = (float)(1.0 - 0.75 / (double)length); for (int index = 0; index < color32Array.Length; ++index) { color32Array[index] = Color32.op_Implicit(this.dotColor); DrawPoints drawPoints = this; drawPoints.dotColor = Color.op_Multiply(drawPoints.dotColor, num); } VectorLine vectorLine = new VectorLine("Dots", new List <Vector2>((IEnumerable <Vector2>)vector2Array), this.dotSize, (LineType)2); vectorLine.SetColors(new List <Color32>((IEnumerable <Color32>)color32Array)); for (int index = 0; index < this.numberOfRings; ++index) { vectorLine.MakeCircle(Vector2.op_Implicit(new Vector2((float)(Screen.get_width() / 2), (float)(Screen.get_height() / 2))), (float)(Screen.get_height() / (index + 2)), this.numberOfDots, this.numberOfDots * index); } vectorLine.Draw(); }
void setDestinationCircle() { Vector3 point = MouseWorldPoint(); //if mouse is over no walk collider, move destination location out of contact with colliders in scene Collider2D overlap = Physics2D.OverlapCircle(point, selectedRadius, 1 << 10); if (overlap) { Ray2D ray = new Ray2D(overlap.transform.position, point - overlap.transform.position); float dist = Vector2.Distance(overlap.transform.position, point); while (overlap) { dist += 0.1f; point = ray.GetPoint(dist); overlap = Physics2D.OverlapCircle(point, selectedRadius, 1 << 10); } } //Draw Destination circle destinationCircle.MakeCircle(point, selectedRadius, 360); destinationCircle.active = true; pathGoal = point; }
public Circle(Vector3 origin, float radius, Color color, int width) { segments = Mathf.Min((int)(radius * 2 * Mathf.PI), MAX_SEGMENTS); vectorLine = new VectorLine("SelectCircle", new Vector3[segments * 2], color, null, width, LineType.Discrete, Joins.Weld); vectorLine.MakeCircle(origin, Vector3.up, radius, segments); prevPosition = origin; circleColor = color; this.radius = radius; //vectorLine.Draw3D(); }
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(); }