public void WrongData() { DrawingTool cnv = new DrawingTool(20, 4); string result = string.Empty; while (true) { if (!cnv.DrawCanvas()) { break; } if (!cnv.DrawLine(new string[] { "1", "2", "6", "2" })) { break; } if (!cnv.DrawLine(new string[] { "6", "3", "25", "4" })) { break; } if (!cnv.DrawRectangle(new string[] { "16", "1", "20", "50" })) { break; } if (!cnv.FillCanvas(10, 3, "o")) { break; } } Console.WriteLine(cnv.dtObj.Result); }
public void ValidData() { DrawingTool cnv = new DrawingTool(20, 4); string result = string.Empty; cnv.DrawCanvas(); cnv.DrawLine(new string[] { "1", "2", "6", "2" }); cnv.DrawLine(new string[] { "6", "3", "6", "4" }); cnv.DrawRectangle(new string[] { "16", "1", "20", "3" }); cnv.FillCanvas(10, 3, "o"); Console.WriteLine(cnv.DrawArray(cnv.Canvas)); }
// Update is called once per frame void Update() { if (activated && Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Collider collider = GetComponent <Collider>(); collider.Raycast(ray, out hit, float.MaxValue); if (hit.collider != null) { Vector2 objectPos = transform.InverseTransformPoint(hit.point); Vector2 thisPoint = new Vector2(objectPos.x + 0.5f, objectPos.y + 0.5f); if (!prevDown) { prevPoint = thisPoint; } drawingTool.DrawLine(prevPoint, thisPoint); prevPoint = thisPoint; } } prevDown = Input.GetMouseButton(0); }