public void UpdateArraySize(int size) { if (tab.Length != size) { tab = new EditorNeuronData[size]; for (int i = 0; i < size; i++) { tab[i] = new EditorNeuronData(); } } }
public static void DisplayNode(Neuron neuron, EditorNeuronData editorNeuronData) { editorNeuronData.isFoldedOut = EditorGUILayout.Foldout(editorNeuronData.isFoldedOut, "Neuron " + neuron.InnovationNb); if (!editorNeuronData.isFoldedOut) { return; } EditorGUI.indentLevel++; EditorGUILayout.EnumPopup("Type:", neuron.Type); EditorGUILayout.LabelField("InGenes:"); editorNeuronData.UpdateArraySize(neuron.InGenes.Count + neuron.OutGenes.Count); int counter = 0; foreach (var gene in neuron.InGenes) { EditorGUI.indentLevel++; DisplayGene(gene, editorNeuronData.tab[counter]); EditorGUI.indentLevel--; counter++; } EditorGUILayout.LabelField("OutGenes:"); foreach (var gene in neuron.OutGenes) { EditorGUI.indentLevel++; DisplayGene(gene, editorNeuronData.tab[counter]); EditorGUI.indentLevel--; counter++; } EditorGUI.indentLevel--; }