public void Output(PathStorage objekt) { for (int i = 0; i < path.Count; i++) { output.WriteLine(objekt); } output.Close(); }
public PathStorage Input(PathStorage objekt) { PathStorage path = new PathStorage(); while (input.ReadLine() != null) { float batman = float.Parse(input.ReadLine()); path.AddPoint(batman); } input.Close(); return path; }
static void Main() { Struct3DPoint point = new Struct3DPoint(2, 1, 5); float distance = CalcDistance.Calculate(Struct3DPoint.Basse,point); Console.WriteLine(distance); List<PathStorage> path = new List<PathStorage>(); PathStorage firstpath = new PathStorage(); for (int i = 0; i < 10; i++) { firstpath.AddPoint(i+0.25f); } }
void Start() { //WPlayerBody = Instantiate (WPlayerObject, transform.position, transform.rotation) as GameObject; //Destroy( WPlayerBody.GetComponent<MeshRenderer>()); //Destroy( WPlayerBody.GetComponent<Collider>()); //Destroy( WPlayerBody.GetComponent<MeshFilter>()); //Destroy(WPlayerBody.GetComponent<Collider>()); rigBody = GetComponent<Rigidbody> (); _agent = GetComponentInChildren<NavMeshAgent>(); storage = FindObjectOfType<PathStorage> (); if (storage != null) { storage.Pathes.Add (path); } }
public void Line(double x1, double y1, double x2, double y2, RGBA_Bytes color) { PathStorage m_LinesToDraw = new PathStorage(); m_LinesToDraw.Clear(); m_LinesToDraw.MoveTo(x1, y1); m_LinesToDraw.LineTo(x2, y2); conv_stroke StrockedLineToDraw = new conv_stroke(m_LinesToDraw); Render(StrockedLineToDraw, color); }
void Line(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, double lineWidth, RendererBase renderer, bool ArrowTip) { PathStorage line = new PathStorage(); line.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset); line.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset); // Drawing as an outline conv_stroke wideLine = new conv_stroke(line); wideLine.width(lineWidth); renderer.Render(wideLine, m_LineColor.GetAsRGBA_Bytes()); if(ArrowTip) { Ellipse Dot = new Ellipse( (Vertex2.m_X * m_Scale * 9 + Vertex1.m_X * m_Scale) / 10 + m_XOffset, (Vertex2.m_Y * m_Scale * 9 + Vertex1.m_Y * m_Scale) / 10 + m_YOffset, 3, 3); GetRenderer().Render(Dot, m_LineColor.GetAsRGBA_Bytes()); } }
public override void OnDraw() { GetRenderer().Clear(new RGBA_Doubles(1, 1, 1)); Tesselator tesselator = new Tesselator(); tesselator.callBegin += new Tesselator.CallBeginDelegate(BeginCallBack); tesselator.callEnd += new Tesselator.CallEndDelegate(EndCallBack); tesselator.callVertex += new Tesselator.CallVertexDelegate(VertexCallBack); tesselator.callCombine += new Tesselator.CallCombineDelegate(CombineCallBack); switch (m_WindingRule.cur_item()) { case 0: tesselator.windingRule = Tesselator.WindingRuleType.Odd; break; case 1: tesselator.windingRule = Tesselator.WindingRuleType.NonZero; break; case 2: tesselator.windingRule = Tesselator.WindingRuleType.Positive; break; case 3: tesselator.windingRule = Tesselator.WindingRuleType.Negative; break; case 4: tesselator.windingRule = Tesselator.WindingRuleType.ABS_GEQ_Two; break; } if (m_EdgeFlag.status()) { tesselator.callEdgeFlag += new Tesselator.CallEdgeFlagDelegate(EdgeFlagCallBack); } if (m_BoundryOnly.status()) // edgesOnly { tesselator.BoundaryOnly = true; } m_TesselateTest.ParseStreamForTesselator(tesselator, m_WhichShape.cur_item()); // now render the outline { string[] instructionStream = Tesselate_Tests.m_InsructionStream[m_WhichShape.cur_item()]; bool gotFirst = false; Tesselate_Tests.Vertex firstInContour = new Tesselate_Tests.Vertex(0, 0); bool havePrev = false; Tesselate_Tests.Vertex prevVertex = new Tesselate_Tests.Vertex(0,0); PathStorage line = new PathStorage(); conv_stroke wideLine; AGG.VertexSource.Ellipse Dot; for (int curInstruction = 0; curInstruction < instructionStream.Length; curInstruction++) { switch (instructionStream[curInstruction]) { case "BC": break; case "EC": gotFirst = false; havePrev = false; line.remove_all(); line.move_to(prevVertex.m_X + 30, prevVertex.m_Y + 100); line.line_to(firstInContour.m_X + 30, firstInContour.m_Y + 100); // Drawing as an outline wideLine = new conv_stroke(line); wideLine.width(1); GetRenderer().Render(wideLine, new RGBA_Bytes(0, 0, 0)); Dot = new Ellipse( (firstInContour.m_X * 9 + prevVertex.m_X)/10 + 30, (firstInContour.m_Y * 9 + prevVertex.m_Y)/10 +100, 3, 3); GetRenderer().Render(Dot, new RGBA_Bytes(0, 0, 0)); break; case "V": double x = Convert.ToDouble(instructionStream[curInstruction + 1]); double y = Convert.ToDouble(instructionStream[curInstruction + 2]); curInstruction += 2; if (!gotFirst) { gotFirst = true; firstInContour = new Tesselate_Tests.Vertex(x, y); } if (!havePrev) { prevVertex = new Tesselate_Tests.Vertex(x, y); havePrev = true; } else { line.remove_all(); line.move_to(prevVertex.m_X + 30, prevVertex.m_Y + 100); line.line_to(x + 30, y + 100); // Drawing as an outline wideLine = new conv_stroke(line); wideLine.width(1); GetRenderer().Render(wideLine, new RGBA_Bytes(0, 0, 0)); line.remove_all(); Dot = new Ellipse( (x * 9 + prevVertex.m_X) / 10 + 30, (y * 9 + prevVertex.m_Y) / 10 + 100, 3, 3); GetRenderer().Render(Dot, new RGBA_Bytes(0, 0, 0)); prevVertex = new Tesselate_Tests.Vertex(x, y); } break; } } } base.OnDraw(); }
void Triangle(Tesselate_Tests.Vertex Vertex1, Tesselate_Tests.Vertex Vertex2, Tesselate_Tests.Vertex Vertex3, RendererBase renderer) { PathStorage triangle = new PathStorage(); triangle.move_to(Vertex1.m_X * m_Scale + m_XOffset, Vertex1.m_Y * m_Scale + m_YOffset); triangle.line_to(Vertex2.m_X * m_Scale + m_XOffset, Vertex2.m_Y * m_Scale + m_YOffset); triangle.line_to(Vertex3.m_X * m_Scale + m_XOffset, Vertex3.m_Y * m_Scale + m_YOffset); renderer.Render(triangle, m_TriangleColor.GetAsRGBA_Bytes()); }