|
6 | 6 |
|
7 | 7 | public class GraphCreator : MonoBehaviour { |
8 | 8 |
|
9 | | - [Header("Точки для вставки в график")] |
10 | | - [SerializeField] GameObject PointFor; |
| 9 | + [Header("Точки для вставки в график / Points to insert into the graph")] |
| 10 | + [SerializeField] GameObject PointToInsert; |
11 | 11 | [SerializeField] Transform PointForUTransform; |
12 | 12 | protected Transform PointForUTransformTmp; |
13 | 13 |
|
14 | | - [Header("UILineRenderer для создания графикa")] |
| 14 | + [Header("UILineRenderer для создания графикa / UILineRenderer to create a graph")] |
15 | 15 | [SerializeField] UILineRenderer LineRenderForCreateGraph; |
16 | 16 |
|
17 | | - [Header("Список вставленных точек в график")] |
| 17 | + [Header("Список вставленных точек в график / List of inserted points in the graph")] |
18 | 18 | public List<GameObject> InstancePoints; |
19 | 19 |
|
20 | | - [Header("Сам график, где рисовать")] |
21 | | - [SerializeField] GameObject Grafik; |
| 20 | + [Header("Сам график, где рисовать / The graph where to draw")] |
| 21 | + [SerializeField] GameObject Graph; |
22 | 22 |
|
23 | | - [Header("Объект, хранящий значения на осях")] |
| 23 | + [Header("Объект, хранящий значения на осях / values on axes")] |
24 | 24 | [SerializeField] |
25 | 25 | Transform axisTextHolder; |
26 | 26 |
|
27 | | - [Header("Длина осей в графике по сторонам Х и У")] |
| 27 | + [Header("Длина осей в графике по сторонам Х и У / The length of the axes in the graph on the sides X and Y")] |
28 | 28 | [SerializeField] float sizeStepX = 50; |
29 | 29 | [SerializeField] float sizeStepY = 50; |
30 | 30 |
|
31 | | - [Header("Количество шагов по оси Х")] |
| 31 | + [Header("Количество шагов по оси Х / Number of steps along the axis X")] |
32 | 32 | [SerializeField] |
33 | 33 | int Xsteps; |
34 | | - [Header("Количество шагов по оси Y")] |
| 34 | + [Header("Количество шагов по оси Y/ Number of steps along the axis Y")] |
35 | 35 | [SerializeField] |
36 | 36 | int Ysteps; |
37 | 37 |
|
38 | 38 | public List<Vector2> dataPoints = new List<Vector2>(); |
39 | 39 | RectTransform mainTransform; |
40 | 40 |
|
41 | | - [Header("стартовая координата по оси Х")] |
| 41 | + [Header("стартовая координата по оси Х / X-axis origin")] |
42 | 42 | [SerializeField] |
43 | 43 | float StartCoordinateX = 0; |
44 | 44 |
|
45 | | - [Header("стартовая координата по оси У")] |
| 45 | + [Header("стартовая координата по оси У / Y-axis origin")] |
46 | 46 | [SerializeField] |
47 | 47 | float StartCoordinateY = 0; |
48 | 48 | protected float step = 0; |
@@ -138,23 +138,22 @@ public void AddPoint() { |
138 | 138 | if (ValidateAddingPoint()) { |
139 | 139 | if (lastPoint == new Vector2(valueX, valueY)) return; |
140 | 140 | dataPoints.Insert(0, new Vector2(valueX, valueY)); |
141 | | - InstancePoints.Insert(0, Instantiate(PointFor, PointForUTransform.position, |
| 141 | + InstancePoints.Insert(0, Instantiate(PointToInsert, PointForUTransform.position, |
142 | 142 | PointForUTransform.rotation)); |
143 | 143 | InstancePoints[0].SetActive(true); |
144 | | - InstancePoints[0].transform.SetParent(PointFor.transform.parent); |
| 144 | + InstancePoints[0].transform.SetParent(PointToInsert.transform.parent); |
145 | 145 | InstancePoints[0].transform.localScale = Vector3.one; |
146 | 146 | InstancePoints[0].GetComponent<RectTransform>().anchoredPosition = |
147 | 147 | new Vector3(InstancePoints[0].GetComponent<RectTransform>().anchoredPosition.x |
148 | 148 | + valueX * |
149 | | - Grafik.GetComponent<RectTransform>().sizeDelta.x / sizeStepX, |
| 149 | + Graph.GetComponent<RectTransform>().sizeDelta.x / sizeStepX, |
150 | 150 | InstancePoints[0].GetComponent<RectTransform>().anchoredPosition.y |
151 | 151 | + valueY * |
152 | | - Grafik.GetComponent<RectTransform>().sizeDelta.y / sizeStepY, 0); |
| 152 | + Graph.GetComponent<RectTransform>().sizeDelta.y / sizeStepY, 0); |
153 | 153 | LineRenderForCreateGraph.Points = new Vector2[InstancePoints.Count]; |
154 | 154 | for (int i = 0; i < InstancePoints.Count; i++) { |
155 | 155 | LineRenderForCreateGraph.Points[i] = new Vector2(InstancePoints[i].GetComponent<RectTransform>().anchoredPosition.x, |
156 | 156 | InstancePoints[i].GetComponent<RectTransform>().anchoredPosition.y); |
157 | | - |
158 | 157 | } |
159 | 158 | lastPoint = new Vector2(valueX, valueY); |
160 | 159 | } |
|
0 commit comments