// TODO : test public void addPhenotypeNetworks() { // add network for every neighbor with a creature for (int i = 1; i < neighborLands.Length; i++) { if (neighborLands[i].creatureIsOn()) { // get a copy of the template // Debug.Log("template first layer length: " + phenotypeNetTemplate.net[0].Count); PhenotypeNetwork phenotypeNet = (PhenotypeNetwork)Copier.copyNetwork(phenotypeNetTemplate, this); // set the phenotype used in the template phenotypeNet.setInputNodes(neighborLands[i].creatureOn.phenotype, i); // add the network to the creatures networks string phenoNetName = "phenotypeNet" + i; networks[0].Add(phenoNetName, phenotypeNet); // for every output node in the phenotype network int length = phenotypeNet.net.Count; for (int j = 0; j < phenotypeNet.net[length - 1].Count; j++) { OutputNode outNode = (OutputNode)phenotypeNet.net[length - 1][j]; // for every output network, add an inner-input node for the phenotype node, if applicable foreach (OutputNetwork net in networks[networks.Count - 1].Values) { // output network must match action of phenotype output node if (net.outputAction.name.Equals(outNode.action.name)) { // create a new inner-input node InnerInputNode node = new InnerInputNode(); // set linked node node.parentCreature = this; node.setLinkedNode(this, 0, phenoNetName, phenotypeNet.net.Count - 1, j); node.temp = true; // add inner-input node to first layer of output network net.net[0].Add(node); // add previous node for all nodes in second layer of output network for (int k = 0; k < net.net[1].Count; k++) { NonInputNode niNode = (NonInputNode)net.net[1][k]; niNode.appendPrevNode(net.net[0][net.net[0].Count - 1]); } } } } } } }
public PhenotypeNetworkEditor(PhenotypeNetwork net, CreatureEditor parentCreatureCreator) : base(net, parentCreatureCreator) { }