public IGraphVisualObject CreateGraphVisualObject(Vector2 graphPosition, float graphPositionWidth, string toolTipText) { GameObject dotGameObject = CreateDot(graphPosition); GameObject dotConnectionGameObject = null; if (lastLineGraphVisualObject != null) { dotConnectionGameObject = CreateDotConnection(lastLineGraphVisualObject.GetGraphPosition(), dotGameObject.GetComponent <RectTransform>().anchoredPosition); } LineGraphVisualObject lineGraphVisualObject = new LineGraphVisualObject(dotGameObject, dotConnectionGameObject, lastLineGraphVisualObject); lineGraphVisualObject.SetGraphVisualObjectInfo(graphPosition, graphPositionWidth, toolTipText); lastLineGraphVisualObject = lineGraphVisualObject; return(lineGraphVisualObject); }
public IGraphVisualObject CreateGraphVisualObject(Vector2 graphPosition, float graphPositionWidth, string tooltipText) { //List<GameObject> gameObjectList = new List<GameObject>(); GameObject dotGameObject = CreateDot(graphPosition); //create a circle on the above x and y points //gameObjectList.Add(dotGameObject); //add this gameobject to the list to be destroyed after spawning GameObject dotConnectionGameObject = null; if (lastLineGraphVisualObject != null) { //if not null(if not the first point), make a line between it and the previous dot dotConnectionGameObject = CreateDotConnection(lastLineGraphVisualObject.GetGraphPosition(), dotGameObject.GetComponent <RectTransform>().anchoredPosition); // gameObjectList.Add(dotConnectionGameObject); //add this gameobject to the list to be destroyed after spawning } LineGraphVisualObject lineGraphVisualObject = new LineGraphVisualObject(dotGameObject, dotConnectionGameObject, lastLineGraphVisualObject); lineGraphVisualObject.SetGraphVisualObjectInfo(graphPosition, graphPositionWidth, tooltipText); lastLineGraphVisualObject = lineGraphVisualObject; return(lineGraphVisualObject); }