public GraphNode(int id, Neuron.NeuronType neuronType, float x, float y) { Id = id; NeuronType = neuronType; X = x; Y = y; Connections = new List <GraphNode>(); Weights = new List <float>(); }
private GameObject AddNode(Vector2 anchoredPosition, Neuron.NeuronType type = Neuron.NeuronType.HIDDEN) { GameObject node = Instantiate(nodePrefab, Vector3.zero, Quaternion.identity, nodeContainer.transform); // Set node size & position RectTransform nodeRec = node.GetComponent <RectTransform>(); nodeRec.sizeDelta = new Vector2(nodeSize, nodeSize); nodeRec.anchoredPosition = anchoredPosition; // Set color Image nodeSprite = node.GetComponent <Image>(); nodeSprite.color = type == Neuron.NeuronType.HIDDEN ? Color.white : Color.green; _nodes.Add(node); return(node); }