protected override void SetTrack(PointF ModelOrigin, Color backColor) { PointF CanvasPosition = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); this.xAxis = new LineDraw(CanvasPosition, new PointF(CanvasPosition.X + Properties.Settings.Default.TrackWidth * 0.5f * 10, CanvasPosition.Y), Properties.Settings.Default.TrackWidth * 0.5f, backColor, true, false); this.yAxis = new LineDraw(CanvasPosition, new PointF(CanvasPosition.X, CanvasPosition.Y - Properties.Settings.Default.TrackWidth * 0.5f * 10), Properties.Settings.Default.TrackWidth * 0.5f, backColor, true, false); }
// Use this for initialization private void Awake() { playerSound = GetComponent <PlayerSoundSetting>(); MyState = GetComponent <PlayerState>(); PlayerViberation = GetComponent <Viberation>(); camTr = Camera.main.transform; MarkerRotate = Beejae_Marker[0].transform.rotation; AzuraHands = new TouchCollision[2]; AzuraHands[0] = Hands[0].GetComponent <TouchCollision>(); AzuraHands[1] = Hands[1].GetComponent <TouchCollision>(); typecheck = GetComponentInChildren <LineDraw>(); if (typecheck.IsHaveSkill(0)) { int poolCount = 5; Azurapool.Create(AzuraBallPrefab, poolCount); AzuraBall = new GameObject[poolCount]; for (int i = 0; i < AzuraBall.Length; ++i) { AzuraBall[i] = null; } } if (typecheck.IsHaveSkill(1)) { int poolCount = 5; Arrowpool.Create(ArrowPrefab, poolCount); Arrow = new GameObject[poolCount]; for (int i = 0; i < Arrow.Length; ++i) { Arrow[i] = null; } } }
protected override void SetTrack(PointF ModelOrigin, Color backColor) { //构造直线轨迹 lines.Clear(); for (int i = 0; i < linesData.Count; i++) { PointF CanvasOrgion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF startPosition = new PointF(CanvasOrgion.X + linesData[i][0].X, CanvasOrgion.Y + linesData[i][0].Y); PointF endPosition = new PointF(CanvasOrgion.X + linesData[i][1].X, CanvasOrgion.Y + linesData[i][1].Y); LineDraw line; if (i == linesData.Count - 1 && this.lastTrackIsLine) { line = new LineDraw(startPosition, endPosition, Properties.Settings.Default.TrackWidth, backColor, true, true); } else { line = new LineDraw(startPosition, endPosition, Properties.Settings.Default.TrackWidth, backColor, false, true); } this.lines.Add(line); } //构造圆弧轨迹 arcs.Clear(); foreach (var item in arcsData) { PointF canvasOrigion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); ArcDraw arc = new ArcDraw(new PointF(canvasOrigion.X + item.Item1[1].X, canvasOrigion.Y + item.Item1[1].Y), new PointF(canvasOrigion.X + item.Item1[0].X, canvasOrigion.Y + item.Item1[0].Y), new PointF(canvasOrigion.X + item.Item1[2].X, canvasOrigion.Y + item.Item1[2].Y), Properties.Settings.Default.TrackWidth, backColor, item.Item2); this.arcs.Add(arc); } }
private void makeSpring(NodeInfo node1, NodeInfo node2, SpringType springType) { SpringInfo newSpringInfo = new SpringInfo(); newSpringInfo.Node1 = node1; newSpringInfo.Node2 = node2; newSpringInfo.SpringType = springType; springs.Add(newSpringInfo); if (initSpringRenderers == true) { GameObject nodeRender = (GameObject)Instantiate(debugRenderer, Vector3.zero, Quaternion.identity); LineDraw nodeDraw = nodeRender.GetComponent <LineDraw>(); nodeDraw.vertices.Add(node1.WorldPosition); nodeDraw.vertices.Add(node2.WorldPosition); nodeDraw.colorStart = Color.white; nodeDraw.colorEnd = Color.red; nodeRender.transform.parent = transform; springLineRenderers[newSpringInfo] = nodeDraw; } }
/// <summary> /// 原点指令(位置,半径,原点颜色,坐标轴颜色) /// </summary> public OriginDrawCmd(bool enable) { this.enable = enable; this.xAxis = new LineDraw(new PointF(0, 0), new PointF(50, 0), Properties.Settings.Default.TrackWidth * 0.5f, Properties.Settings.Default.TrackNormalColor, true, false); this.yAxis = new LineDraw(new PointF(0, 0), new PointF(0, -50), Properties.Settings.Default.TrackWidth * 0.5f, Properties.Settings.Default.TrackNormalColor, true, false); }
public void CreateNewLine() { activeLineDraw = Instantiate(lineDrawPrefab).GetComponent <LineDraw>(); Vector2[] startingPoints = new Vector2[2]; startingPoints[0] = new Vector3(20, 0, 0); startingPoints[1] = new Vector3(20, 1, 0); activeLineDraw.edgeCollider.points = startingPoints; }
void Start() { self = this.gameObject; Debug.Log(self.name.ToString()); drawingObject = GameObject.FindGameObjectWithTag("Line").gameObject; Debug.Log(drawingObject.name.ToString()); drawing = drawingObject.GetComponent <LineDraw>(); }
public void InstantiateMainContinent(ConnectionManager conMan, GameManager gameMan, LineDraw lineMan, GameObject man, float rate) { connectionManager = conMan; gameManager = gameMan; lineDraw = lineMan; player = man; _updateRate = rate; }
protected override void SetTrack(PointF ModelOrigin, Color backColor) { PointF CanvasOrgion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF startPosition = new PointF(CanvasOrgion.X + startPoint.X, CanvasOrgion.Y + startPoint.Y); PointF endPosition = new PointF(CanvasOrgion.X + endPoint.X, CanvasOrgion.Y + endPoint.Y); this.line = new LineDraw(startPosition, endPosition, Properties.Settings.Default.TrackWidth, backColor, isArrowLine, true); }
// Start is called before the first frame update void Start() { joint = new JointMotor2D(); joint.motorSpeed = 600; joint.maxMotorTorque = 1000; controllerScript = controller.GetComponent <LineDraw>(); wheels = controllerScript.AdditionalObjects; restartButton.onClick.AddListener(() => RestartScene()); }
private void Awake() { line = GetComponent <LineDraw>(); audio = GetComponent <AudioSource>(); handle = FindObjectOfType <AttackMethod>(); handle2 = FindObjectOfType <Beejea_Verbase_Setting>(); Player = FindObjectOfType <PlayerState>(); deltaTime = Time.deltaTime; collider = GetComponent <Collider>(); }
public void setDrawBehavior(bool setToDrag) { if (setToDrag) { drawBehavior = new LineDrag(); } else { drawBehavior = new LineAccept(); } }
protected override void SetTrack(PointF ModelOrigin, Color backColor) { PointF canvasOrigion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF centerPosition = new PointF(canvasOrigion.X + position.X, canvasOrigion.Y + position.Y); this.upArrow = new LineDraw(centerPosition, new PointF(centerPosition.X, centerPosition.Y + Properties.Settings.Default.TrackWidth * 0.5f * 2), Properties.Settings.Default.TrackWidth * 0.5f * 0.25f, backColor, true, false); this.downArrow = new LineDraw(centerPosition, new PointF(centerPosition.X, centerPosition.Y - Properties.Settings.Default.TrackWidth * 0.5f * 2), Properties.Settings.Default.TrackWidth * 0.5f * 0.25f, backColor, true, false); this.upLine = new LineDraw(new PointF(centerPosition.X - Properties.Settings.Default.TrackWidth * 0.5f, centerPosition.Y + Properties.Settings.Default.TrackWidth * 0.5f * 2), new PointF(centerPosition.X + Properties.Settings.Default.TrackWidth * 0.5f, centerPosition.Y + Properties.Settings.Default.TrackWidth * 0.5f * 2), Properties.Settings.Default.TrackWidth * 0.5f * 0.25f, backColor, false, false); this.downLine = new LineDraw(new PointF(centerPosition.X - Properties.Settings.Default.TrackWidth * 0.5f, centerPosition.Y - Properties.Settings.Default.TrackWidth * 0.5f * 2), new PointF(centerPosition.X + Properties.Settings.Default.TrackWidth * 0.5f, centerPosition.Y - Properties.Settings.Default.TrackWidth * 0.5f * 2), Properties.Settings.Default.TrackWidth * 0.5f * 0.25f, backColor, false, false); }
protected override void SetTrack(PointF ModelOrigin, Color backColor) { PointF canvasOrigin = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF position = new PointF(this.position.X + canvasOrigin.X, this.position.Y + canvasOrigin.Y); this.circle = new CircleDraw(new PointF(position.X, position.Y), Properties.Settings.Default.TrackWidth, Properties.Settings.Default.TrackWidth * 0.25f, backColor); this.upLine = new LineDraw(new PointF(position.X, position.Y + Properties.Settings.Default.TrackWidth * 0.5f), new PointF(position.X, position.Y + Properties.Settings.Default.TrackWidth * (float)1.2), Properties.Settings.Default.TrackWidth * 0.12f, backColor, false, true); this.downLine = new LineDraw(new PointF(position.X, position.Y - Properties.Settings.Default.TrackWidth * 0.5f), new PointF(position.X, position.Y - Properties.Settings.Default.TrackWidth * (float)1.2), Properties.Settings.Default.TrackWidth * 0.12f, backColor, false, true); this.leftLine = new LineDraw(new PointF(position.X - Properties.Settings.Default.TrackWidth * 0.5f, position.Y), new PointF(position.X - Properties.Settings.Default.TrackWidth * (float)1.2, position.Y), Properties.Settings.Default.TrackWidth * 0.12f, backColor, false, true); this.rightLine = new LineDraw(new PointF(position.X + Properties.Settings.Default.TrackWidth * 0.5f, position.Y), new PointF(position.X + Properties.Settings.Default.TrackWidth * (float)1.2, position.Y), Properties.Settings.Default.TrackWidth * 0.12f, backColor, false, true); }
protected override void SetTrack(PointF ModelOrigin, Color backColor) { //构造直线轨迹 lines.Clear(); for (int i = 0; i < linesData.Count; i++) { PointF CanvasOrgion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF startPosition = new PointF(CanvasOrgion.X + linesData[i][0].X, CanvasOrgion.Y + linesData[i][0].Y); PointF endPosition = new PointF(CanvasOrgion.X + linesData[i][1].X, CanvasOrgion.Y + linesData[i][1].Y); LineDraw line; if (i == linesData.Count - 1 && this.lastTrackIsLine) { line = new LineDraw(startPosition, endPosition, Properties.Settings.Default.TrackWidth, backColor, true, true); } else { line = new LineDraw(startPosition, endPosition, Properties.Settings.Default.TrackWidth, backColor, false, true); } this.lines.Add(line); } //构造圆弧轨迹 arcs.Clear(); foreach (var item in arcsData) { PointF canvasOrigion = DrawingUtils.Instance.CoordinateTrans(ModelOrigin); PointF centerPoint = MathUtils.CalculateCircleCenter(item.Item1[0], item.Item1[1], item.Item1[2]); float degree = -(float)MathUtils.CalculateDegree(new Anda.Fluid.Infrastructure.Common.PointD((double)item.Item1[0].X, (double)item.Item1[0].Y), new Anda.Fluid.Infrastructure.Common.PointD((double)item.Item1[1].X, (double)item.Item1[1].Y), new Anda.Fluid.Infrastructure.Common.PointD((double)item.Item1[2].X, (double)item.Item1[2].Y), new Anda.Fluid.Infrastructure.Common.PointD((double)centerPoint.X, (double)centerPoint.Y)); ArcDraw arc = new ArcDraw(new PointF(canvasOrigion.X + centerPoint.X, canvasOrigion.Y + centerPoint.Y), new PointF(canvasOrigion.X + item.Item1[0].X, canvasOrigion.Y + item.Item1[0].Y), new PointF(canvasOrigion.X + item.Item1[2].X, canvasOrigion.Y + item.Item1[2].Y), Properties.Settings.Default.TrackWidth, backColor, degree); this.arcs.Add(arc); } }
// Initiates the mechanics for the slingshot void Start() { lines = new LineDraw(gameObject); control = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Controller>(); spring = GetComponent <SpringJoint2D>(); lines.front = GameObject.FindGameObjectWithTag("front").GetComponent <LineRenderer>(); lines.back = GameObject.FindGameObjectWithTag("back").GetComponent <LineRenderer>(); spring.connectedBody = GameObject.FindGameObjectWithTag("front").GetComponent <Rigidbody2D>(); slingshot = spring.connectedBody.transform; lines.rayToMouse = new Ray(slingshot.position, Vector3.zero); lines.leftToProjectile = new Ray(lines.front.transform.position, Vector3.zero); maxStretchSqr = maxStretch * maxStretch; rigidbody2D.isKinematic = true; spring.enabled = true; lines.front.enabled = true; lines.back.enabled = true; lines.LineRendererSetup(); }
/// <summary> /// Button for find path. /// </summary> public void btnFindPath() { // Only find if there are start and end node. if (startNode != null && endNode != null) { //limpar camino GameObject[] drawlineners = GameObject.FindGameObjectsWithTag("Node"); foreach (GameObject n in drawlineners) { Renderer rend = n.GetComponent <Renderer>(); rend.material.color = Color.gray; n.GetComponent <LineDraw>().endDraw(); } // Execute Shortest Path. ShortestPath finder = gameObject.GetComponent <ShortestPath>(); List <Transform> paths = finder.findShortestPath(startNode, endNode); int sizeOfList = paths.Count; foreach (Transform path in paths) { Renderer rend = path.GetComponent <Renderer>(); rend.material.color = Color.grey; } ListTransfor pathsList = new ListTransfor(); // Colour the node red. foreach (Transform path in paths) { Renderer rend = path.GetComponent <Renderer>(); LineDraw line = GetComponent <LineDraw>(); rend.material.color = Color.blue; //line.origin = path; pathsList.add(path); } pathsList.print(); pathsList.drawLine(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); line = GetComponent <LineRenderer>(); edge = GetComponent <EdgeCollider2D>(); line.sortingLayerName = "TopLayer"; reloadPlayer(); drawBehavior = new LineDrag(); }
public void drawLine() { NodoTransform aux = begin; Debug.Log("===============================Caminos========================"); float dist = 0; while (aux != null) { if (aux.getSiguiente() != null) { LineDraw ln = aux.getData().GetComponent <LineDraw>(); ln.origin = aux.getData(); ln.destination = aux.getSiguiente().getData(); ln.startDraw(); float dis = Vector3.Distance(aux.getData().position, aux.getSiguiente().getData().position); dist = dist + dis; Debug.Log("Del punto:" + aux.getData().name + "Hasta:" + aux.getSiguiente().getData().name + "Distancia:" + dis); } aux = aux.getSiguiente(); } Debug.Log("=========================TOTAL=============================="); Debug.Log("Distancia tota: " + dist); }
private void makeTriangle(NodeInfo node1, NodeInfo node2, NodeInfo node3) { TriangleInfo newTriangleInfo = new TriangleInfo(); newTriangleInfo.Node1 = node1; newTriangleInfo.Node2 = node2; newTriangleInfo.Node3 = node3; triangles.Add(newTriangleInfo); if (initTriangleRenderers == true) { GameObject nodeRender1 = (GameObject)Instantiate(debugRenderer, Vector3.zero, Quaternion.identity); LineDraw nodeDraw1 = nodeRender1.GetComponent <LineDraw>(); nodeDraw1.vertices.Add(node1.WorldPosition); nodeDraw1.vertices.Add(node2.WorldPosition); nodeDraw1.vertices.Add(node3.WorldPosition); nodeDraw1.vertices.Add(node1.WorldPosition); nodeDraw1.colorStart = Color.white; nodeDraw1.colorEnd = Color.green; nodeRender1.transform.parent = transform; } }
public bool IsHitting(PointF mouseLocationInModel, DirectiveDraw entity) { LineDraw line = entity as LineDraw; return(Geometry.PointInLine(mouseLocationInModel, line.startPoint, line.endPoint, line.lineWidth)); }
void Start() { if(ins==null){ ins=this; } positions = new List<Vector3> (); CreateSquare (); // CreateFull (); }
unsafe int[] Fill() { int bLen = Length; if (bLen == 0) bLen = GetSize(); var w = Width; var h = Height; var data = new int[bLen]; var destLen = data.Length; int j = 0; var CX = w / 2f; var CY = h / 2f; var dbw = w * 2; var dbh = h * 2; FillAction action; FillAction action1; IColorEnumerator enumerator; LineDraw draw = LineDraw.NonAA; fixed (int* d = data) { switch (Style.Gradient) { #region None case Gradient.None: data = Style[0].Repeat(bLen); break; #endregion #region Horizontal, Vertical, ForwardDiagonal, BackwardDiagonal, default case Gradient.Horizontal: case Gradient.Vertical: case Gradient.ForwardDiagonal: case Gradient.BackwardDiagonal: default: data = Style.GetEnumerator().ToArray(0, data.Length, data.Length); break; #endregion #region HorizontalCentral, VerticalCentral, DiagonalCentral, Followshape, HorizontalSwitch case Gradient.HorizontalCentral: case Gradient.VerticalCentral: case Gradient.DiagonalCentral: case Gradient.HorizontalSwitch: data = Style.GetEnumerator().ToArray(0, data.Length, Length, true); break; #endregion #region Central case Gradient.Central: var pixels = new List<Point>(500); action = Renderer.CreateFillAction(pixels); enumerator = Style.GetEnumerator(); Renderer.ProcessLine(Factory.newLine(0, 0, 0, h), draw, action);//l Renderer.ProcessLine(Factory.newLine(w, 0, w, h), draw, action); //r enumerator.MaxIteration = pixels.Count; action1 = Renderer.CreateFillAction(enumerator, d, data.Length, w); enumerator.Freeze = true; foreach (var line in pixels.Select(x => Factory.newLine(x.X, x.Y, CX, CY))) { Renderer.ProcessLine(line, LineDraw.NonAA, action1); enumerator.MoveNext(true); } pixels.Clear(); Renderer.ProcessLine(Factory.newLine(0, 0, w, 0), draw, action); //t Renderer.ProcessLine(Factory.newLine(0, h, w, h), draw, action); //b enumerator.Reset(); enumerator.MaxIteration = pixels.Count; foreach (var line in pixels.Select(x => Factory.newLine(x.X, x.Y, CX, CY))) { Renderer.ProcessLine(line, LineDraw.NonAA, action1); enumerator.MoveNext(true); } break; #endregion #region CentralD case Gradient.CentralD: enumerator = Style.GetEnumerator(); action1 = Renderer.CreateFillAction(enumerator, d, data.Length, w); enumerator.MaxIteration = h; enumerator.Freeze = true; for (int i = 0; i <= h; i++) { Renderer.ProcessLine(Factory.newLine(0, i, CX, CY), LineDraw.NonAA, action1); enumerator.MoveNext(true); if (enumerator.CurrentPosition == dbh) continue; Renderer.ProcessLine(Factory.newLine(w, i, CX, CY), LineDraw.NonAA, action1); } enumerator.MaxIteration = w; enumerator.Reset(); for (int i = 0; i <= w; i++) { Renderer.ProcessLine(Factory.newLine(i, 0, CX, CY), LineDraw.NonAA, action1); enumerator.MoveNext(true); if (enumerator.CurrentPosition == dbw) continue; Renderer.ProcessLine(Factory.newLine(i, h, CX, CY), LineDraw.NonAA, action1); } break; #endregion } } return data; }
public bool IsContain(RectangleF mouseRect, DirectiveDraw entity) { LineDraw line = entity as LineDraw; return(Geometry.RectContainLine(mouseRect, line.startPoint, line.endPoint)); }