private void HandleTicsZ() { if (graph.zTicStep <= 0) { return; } //Make missing tics //Above zero float i = graph.zTicStep; while (i <= graph.zMax) { bool exists = false; foreach (Tic tic in zTics) { if (tic.value == i) { exists = true; } } if (exists == false) { Tic newTic = Instantiate(ticPrefab, zAxisMasterContainer.transform); newTic.graph = this.graph; newTic.axis = "z"; newTic.value = i; newTic.SetPosition(); zTics.Add(newTic); newTic.MakeLabel(); newTic.ScaleUpFromZero(); } i += graph.zTicStep; } //Below zero i = -graph.zTicStep; while (i >= graph.zMin) { bool exists = false; foreach (Tic tic in zTics) { if (tic.value == i) { exists = true; } } if (exists == false) { Tic newTic = Instantiate(ticPrefab, zAxisMasterContainer.transform); newTic.graph = this.graph; newTic.axis = "z"; newTic.value = i; newTic.SetPosition(); zTics.Add(newTic); newTic.MakeLabel(); newTic.ScaleUpFromZero(); } i -= graph.zTicStep; } }
public void HandleTicsY() { if (graph.yTicStep <= 0) { return; } if (!graph.manualTicMode) { List <Tic> toRemove = new List <Tic>(yTics); //Make missing tics //Above zero float i = graph.yTicStep; while (i <= graph.yMax) { bool exists = false; foreach (Tic tic in yTics) { if (tic.value == i) { exists = true; toRemove.Remove(tic); } } if (exists == false) { Tic newTic = Instantiate(ticPrefab, yAxisMasterContainer.transform); newTic.graph = this.graph; newTic.axis = "y"; newTic.value = i; newTic.SetPosition(); yTics.Add(newTic); newTic.MakeLabel(); newTic.ScaleUpFromZero(); } i += graph.yTicStep; } //Below zero i = -graph.yTicStep; while (i >= graph.yMin) { bool exists = false; foreach (Tic tic in yTics) { if (tic.value == i) { exists = true; toRemove.Remove(tic); } } if (exists == false) { Tic newTic = Instantiate(ticPrefab, yAxisMasterContainer.transform); newTic.graph = this.graph; newTic.axis = "y"; newTic.value = i; newTic.SetPosition(); yTics.Add(newTic); newTic.MakeLabel(); newTic.ScaleUpFromZero(); } i -= graph.yTicStep; } foreach (Tic tic in toRemove) { yTics.Remove(tic); //Hacky way of destroying ones that are gone without a coroutine if (tic.transform.localScale == Vector3.zero) { Destroy(tic); } else { tic.ScaleDownToZero(); } } } else //Manual tic mode { foreach (KeyValuePair <float, string> entry in graph.manualTicsY) { bool exists = false; foreach (Tic tic in xTics) { if (tic.value == entry.Key) { exists = true; } } if (exists == false) { Tic newTic = Instantiate(ticPrefab, xAxisMasterContainer.transform); newTic.graph = this.graph; newTic.axis = "y"; newTic.value = entry.Key; newTic.SetPosition(); yTics.Add(newTic); newTic.MakeLabel(entry.Value); newTic.ScaleUpFromZero(); } } } }