Beispiel #1
0
    public override object Read(ES2Reader reader)
    {
        AddonOscillatorInput data = new AddonOscillatorInput();

        Read(reader, data);
        return(data);
    }
 public AddonOscillatorInput CloneThisAddon() {
     AddonOscillatorInput clonedAddon = new AddonOscillatorInput(this.critterNodeID, this.innov);
     clonedAddon.frequency[0] = this.frequency[0];
     clonedAddon.amplitude[0] = this.amplitude[0];
     clonedAddon.offset[0] = this.offset[0];
     return clonedAddon;
 }
    public AddonOscillatorInput CloneThisAddon()
    {
        AddonOscillatorInput clonedAddon = new AddonOscillatorInput(this.critterNodeID, this.innov);

        clonedAddon.frequency[0] = this.frequency[0];
        clonedAddon.amplitude[0] = this.amplitude[0];
        clonedAddon.offset[0]    = this.offset[0];
        return(clonedAddon);
    }
 public SegaddonOscillatorInput(AddonOscillatorInput sourceNode) {
     value = new float[1];
     value[0] = 1f;
     frequency = new float[1];
     frequency[0] = sourceNode.frequency[0];
     amplitude = new float[1];
     amplitude[0] = sourceNode.amplitude[0];
     offset = new float[1];
     offset[0] = sourceNode.offset[0];
 }
 public SegaddonOscillatorInput(AddonOscillatorInput sourceNode)
 {
     value        = new float[1];
     value[0]     = 1f;
     frequency    = new float[1];
     frequency[0] = sourceNode.frequency[0];
     amplitude    = new float[1];
     amplitude[0] = sourceNode.amplitude[0];
     offset       = new float[1];
     offset[0]    = sourceNode.offset[0];
 }
Beispiel #6
0
    public override void Write(object obj, ES2Writer writer)
    {
        AddonOscillatorInput data = (AddonOscillatorInput)obj;

        // Add your writer.Write calls here.
        writer.Write(0); // Version 0 is current version number
        // Make sure to edit Read() function to properly handle version control!
        // VERSION 0:
        writer.Write(data.critterNodeID);
        writer.Write(data.innov);
        writer.Write(data.frequency);
        writer.Write(data.amplitude);
        writer.Write(data.offset);
    }
Beispiel #7
0
    public override void Read(ES2Reader reader, object c)
    {
        AddonOscillatorInput data = (AddonOscillatorInput)c;
        // Add your reader.Read calls here to read the data into the object.
        // Read the version number.
        int fileVersion = reader.Read <int>();

        // VERSION 0:
        if (fileVersion >= 0)
        {
            data.critterNodeID = reader.Read <System.Int32>();
            data.innov         = reader.Read <System.Int32>();
            data.frequency     = reader.ReadArray <System.Single>();
            data.amplitude     = reader.ReadArray <System.Single>();
            data.offset        = reader.ReadArray <System.Single>();
        }
    }
	public override object Read(ES2Reader reader)
	{
		AddonOscillatorInput data = new AddonOscillatorInput();
		Read(reader, data);
		return data;
	}
    public void PerformBodyMutation(ref CritterGenome bodyGenome, ref GenomeNEAT brainGenome) {
        int numBodyMutations = 0;
        //float attachDirMutationMultiplier = 0.1f;
        //float restAngleDirMutationMultiplier = 0.1f;
        float jointAngleTypeMultiplier = 0.5f;
        List<int> nodesToDelete = new List<int>();        
        for (int i = 0; i < bodyGenome.CritterNodeList.Count; i++) {
            
            // Segment Proportions:
            if(CheckForMutation(segmentProportionChance * bodyMutationBlastModifier)) {  // X
                bodyGenome.CritterNodeList[i].dimensions.x = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].dimensions.x);
                numBodyMutations++;
            }
            if (CheckForMutation(segmentProportionChance * bodyMutationBlastModifier)) {  // Y
                bodyGenome.CritterNodeList[i].dimensions.y = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].dimensions.y);
                numBodyMutations++;
            }
            if (CheckForMutation(segmentProportionChance * bodyMutationBlastModifier)) {  // Z
                bodyGenome.CritterNodeList[i].dimensions.z = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].dimensions.z);
                numBodyMutations++;
            }
            if(i > 0) {   // NOT THE ROOT SEGMENT!:
                // REMOVE SEGMENT!!!!
                if(CheckForMutation(removeSegmentChance * bodyMutationBlastModifier)) {  // Can't delete Root Segment
                    // Add this nodeID into queue for deletion at the end of mutation, to avoid shortening NodeList while traversing it:
                    nodesToDelete.Add(i);                    
                }
                else {
                    // Segment Attach Settings:
                    if (CheckForMutation(segmentAttachSettingsChance * bodyMutationBlastModifier)) {  // Position X
                        bodyGenome.CritterNodeList[i].jointLink.attachDir = MutateBodyVector3Normalized(bodyGenome.CritterNodeList[i].jointLink.attachDir);
                        numBodyMutations++;
                    }
                    if (CheckForMutation(segmentAttachSettingsChance * bodyMutationBlastModifier)) {  // Orientation X
                        bodyGenome.CritterNodeList[i].jointLink.restAngleDir = MutateBodyVector3Normalized(bodyGenome.CritterNodeList[i].jointLink.restAngleDir);
                        numBodyMutations++;
                    }

                    // Joint Settings:
                    if (CheckForMutation(jointSettingsChance * bodyMutationBlastModifier)) {
                        bodyGenome.CritterNodeList[i].jointLink.jointLimitPrimary = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].jointLink.jointLimitPrimary);
                    }
                    if (CheckForMutation(jointSettingsChance * bodyMutationBlastModifier)) {
                        bodyGenome.CritterNodeList[i].jointLink.jointLimitSecondary = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].jointLink.jointLimitSecondary);
                    }
                    if (CheckForMutation(jointSettingsChance * bodyMutationBlastModifier)) {
                        bodyGenome.CritterNodeList[i].jointLink.recursionScalingFactor = MutateBodyFloatMult(bodyGenome.CritterNodeList[i].jointLink.recursionScalingFactor);
                    }
                    // Joint Hinge TYPE!!!!  --- how to handle this???
                    if (CheckForMutation(jointSettingsChance * jointAngleTypeMultiplier * bodyMutationBlastModifier)) {
                        int jointTypeInt = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 4f));
                        bodyGenome.CritterNodeList[i].jointLink.jointType = (CritterJointLink.JointType)jointTypeInt;
                        Debug.Log(i.ToString() + " Mutated to JointType: " + bodyGenome.CritterNodeList[i].jointLink.jointType);
                    }

                    // RECURSION:
                    if (CheckForMutation(recursionChance * bodyMutationBlastModifier)) {
                        int addRemove = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 1f)) * 2 - 1;  // either -1 or 1
                                                                                                     //addRemove = 1; // TEMPORARY!!! testing add recursion
                        if (bodyGenome.CritterNodeList[i].jointLink.numberOfRecursions + addRemove < 0 || bodyGenome.CritterNodeList[i].jointLink.numberOfRecursions + addRemove > 3) {
                            // Do Nothing, tried to change numRecursions beyond the CAP
                        }
                        else {  // It's all good -- PROCEED:
                            bodyGenome.CritterNodeList[i].jointLink.numberOfRecursions += addRemove;
                            numBodyMutations++;

                            if (addRemove > 0) {  // Created an additional Recursion -- Need to ADD new BrainNodes:
                                                  //int numNodesBefore = brainGenome.nodeNEATList.Count;                            
                                                  //brainGenome.AdjustBrainAfterBodyChange(bodyGenome);
                                                  //int numNodesAfter = brainGenome.nodeNEATList.Count;
                                                  //Debug.Log("MUTATION RECURSION! b4#: " + numNodesBefore.ToString() + ", after#: " + numNodesAfter.ToString());
                            }
                            else {  // REMOVED a Recursion -- Need to REMOVE BrainNodes:
                                    //brainGenome.AdjustBrainRemovedRecursion(bodyGenome, i);
                            }
                            
                        }
                        // NEED TO FIX BRAIN!!! -- how to preserve existing wiring while adding new neurons that may re-order?
                        // Do I need to save a reference to segment/nodes within each input/output neuron?
                    }

                    // SYMMETRY
                    if (CheckForMutation(symmetryChance * bodyMutationBlastModifier)) {
                        int symmetryType = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 2f));  // 0=none,1=x, or 2=y
                        Debug.Log("Mutated Symmetry! " + bodyGenome.CritterNodeList[i].jointLink.symmetryType.ToString() + " => " + ((CritterJointLink.SymmetryType)symmetryType).ToString());
                        bodyGenome.CritterNodeList[i].jointLink.symmetryType = (CritterJointLink.SymmetryType)symmetryType;                        
                    }
                    // EXTRA -- recursion forward, only attach to tail
                }

                // CREATE NEW ADD-ON!!  On this segment
                if (CheckForMutation(newAddonChance * bodyMutationBlastModifier)) {
                    // Which types can be created automatically??
                    // 
                    int randomAddon = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 1f));
                    switch (randomAddon) {
                        case 0:
                            AddonOscillatorInput newOscillatorInput = new AddonOscillatorInput(i, GetNextAddonInnov());
                            bodyGenome.addonOscillatorInputList.Add(newOscillatorInput);
                            break;
                        case 1:
                            AddonValueInput newValueInput = new AddonValueInput(i, GetNextAddonInnov());
                            bodyGenome.addonValueInputList.Add(newValueInput);
                            break;
                        default:
                            break;
                    }
                    Debug.Log("NEW ADDON! " + randomAddon.ToString() + ", segmentNode: " + i.ToString());
                }
            }            
        }

        for(int i = 0; i < nodesToDelete.Count; i++) {
            Debug.Log("DELETE SEGMENT NODE! " + i.ToString());
            bodyGenome.DeleteNode(nodesToDelete[i]);
            bodyGenome.RenumberNodes();
        }
        List<int> nodesToAddTo = new List<int>(); // After Deleting nodes, check all remaining nodes for a chance to have a child segment added:
        for (int i = 0; i < bodyGenome.CritterNodeList.Count; i++) {
            if (CheckForMutation(newSegmentChance * bodyMutationBlastModifier)) {
                nodesToAddTo.Add(i);
            }
        }
        for (int i = 0; i < nodesToAddTo.Count; i++) {
            Vector3 attachDir = Vector3.Slerp(new Vector3(0f, 0f, 1f), UnityEngine.Random.onUnitSphere, UnityEngine.Random.Range(0f, 1f)); //ConvertWorldSpaceToAttachDir(selectedSegment, rightClickWorldPosition);
            int nextID = bodyGenome.CritterNodeList.Count;
            bodyGenome.AddNewNode(bodyGenome.CritterNodeList[nodesToAddTo[i]], attachDir, new Vector3(0f, 0f, 0f), nextID, GetNextNodeInnov());

            // Init joint type:
            bodyGenome.CritterNodeList[bodyGenome.CritterNodeList.Count - 1].jointLink.jointType = (CritterJointLink.JointType)Mathf.RoundToInt(UnityEngine.Random.Range(1, 4));

            // Auto-Add-ons: -- New Segment starts with a joint angle sensor and joint Motor by default:
            AddonJointAngleSensor newJointAngleSensor = new AddonJointAngleSensor(nextID, GetNextAddonInnov());
            bodyGenome.addonJointAngleSensorList.Add(newJointAngleSensor);
            // Motor:
            AddonJointMotor newJointMotor = new AddonJointMotor(nextID, GetNextAddonInnov());
            bodyGenome.addonJointMotorList.Add(newJointMotor);

            Debug.Log("New SEGMENT! : " + nodesToAddTo[i].ToString());
        }        

        // Addon Mutation:
        PerformAddonMutation(ref bodyGenome, ref brainGenome);
        //Debug.Log("NumBodyMutations: " + numBodyMutations.ToString());
    }
    public void ClickAttachAddon() {
        Debug.Log("Attach Addon: " + ((CritterNodeAddonBase.CritterNodeAddonTypes)critterEditorUI.panelNodeAddons.dropdownAddonType.value).ToString());
        CritterNodeAddonBase.CritterNodeAddonTypes addonType = (CritterNodeAddonBase.CritterNodeAddonTypes)critterEditorUI.panelNodeAddons.dropdownAddonType.value;
        CritterNode sourceNode = selectedSegment.GetComponent<CritterSegment>().sourceNode;
        
        if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.PhysicalAttributes) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonPhysicalAttributesList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonPhysicalAttributesList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the JointMotor type
                AddonPhysicalAttributes newPhysicalAttributes = new AddonPhysicalAttributes(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonPhysicalAttributesList.Add(newPhysicalAttributes);
                //critterEditorUI.panelNodeAddons.panelAddonsList.GetComponent<PanelAddonsList>().RepopulateList(critterConstructorManager.masterCritter.masterCritterGenome, sourceNode.ID);
            }
        }
        
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.JointAngleSensor) {            
            bool listContainsType = false;
            // Move duplicate check to an Add Addon function within the CritterGenome? to handle it automagically?
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonJointAngleSensorList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonJointAngleSensorList[i].critterNodeID == sourceNode.ID) {
                    // there already exists a jointMotor!!
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the newJointAngleSensor type
                AddonJointAngleSensor newJointAngleSensor = new AddonJointAngleSensor(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonJointAngleSensorList.Add(newJointAngleSensor);
                //critterEditorUI.panelNodeAddons.panelAddonsList.GetComponent<PanelAddonsList>().RepopulateList(critterConstructorManager.masterCritter.masterCritterGenome, sourceNode.ID);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.ContactSensor) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonContactSensorList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonContactSensorList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the ContactSensor type
                AddonContactSensor newContactSensor = new AddonContactSensor(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonContactSensorList.Add(newContactSensor);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.RaycastSensor) {
            AddonRaycastSensor newRaycastSensor = new AddonRaycastSensor(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonRaycastSensorList.Add(newRaycastSensor);            
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.CompassSensor1D) {
            AddonCompassSensor1D newCompassSensor1D = new AddonCompassSensor1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonCompassSensor1DList.Add(newCompassSensor1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.CompassSensor3D) {
            AddonCompassSensor3D newCompassSensor3D = new AddonCompassSensor3D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonCompassSensor3DList.Add(newCompassSensor3D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.PositionSensor1D) {
            AddonPositionSensor1D newPositionSensor1D = new AddonPositionSensor1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonPositionSensor1DList.Add(newPositionSensor1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.PositionSensor3D) {
            AddonPositionSensor3D newPositionSensor3D = new AddonPositionSensor3D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonPositionSensor3DList.Add(newPositionSensor3D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.RotationSensor1D) {
            AddonRotationSensor1D newRotationSensor1D = new AddonRotationSensor1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonRotationSensor1DList.Add(newRotationSensor1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.RotationSensor3D) {
            AddonRotationSensor3D newRotationSensor3D = new AddonRotationSensor3D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonRotationSensor3DList.Add(newRotationSensor3D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.VelocitySensor1D) {
            AddonVelocitySensor1D newVelocitySensor1D = new AddonVelocitySensor1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonVelocitySensor1DList.Add(newVelocitySensor1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.VelocitySensor3D) {
            AddonVelocitySensor3D newVelocitySensor3D = new AddonVelocitySensor3D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonVelocitySensor3DList.Add(newVelocitySensor3D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.Altimeter) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonAltimeterList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonAltimeterList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the Altimeter type
                AddonAltimeter newAltimeter = new AddonAltimeter(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonAltimeterList.Add(newAltimeter);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.EarBasic) {
            AddonEarBasic newEarBasic = new AddonEarBasic(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonEarBasicList.Add(newEarBasic);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.Gravity) {
            AddonGravitySensor newGravitySensor = new AddonGravitySensor(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonGravitySensorList.Add(newGravitySensor);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.OscillatorInput) {
            AddonOscillatorInput newOscillatorInput = new AddonOscillatorInput(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonOscillatorInputList.Add(newOscillatorInput);
            //critterEditorUI.panelNodeAddons.panelAddonsList.GetComponent<PanelAddonsList>().RepopulateList(critterConstructorManager.masterCritter.masterCritterGenome, sourceNode.ID);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.ValueInput) {
            AddonValueInput newValueInput = new AddonValueInput(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonValueInputList.Add(newValueInput);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.TimerInput) {
            AddonTimerInput newTimerInput = new AddonTimerInput(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonTimerInputList.Add(newTimerInput);
        }

        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.JointMotor) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonJointMotorList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonJointMotorList[i].critterNodeID == sourceNode.ID) {
                    // there already exists a jointMotor!!
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the JointMotor type
                AddonJointMotor newJointMotor = new AddonJointMotor(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonJointMotorList.Add(newJointMotor);
                //critterEditorUI.panelNodeAddons.panelAddonsList.GetComponent<PanelAddonsList>().RepopulateList(critterConstructorManager.masterCritter.masterCritterGenome, sourceNode.ID);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.ThrusterEffector1D) {
            AddonThrusterEffector1D newThrusterEffector1D = new AddonThrusterEffector1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonThrusterEffector1DList.Add(newThrusterEffector1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.ThrusterEffector3D) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonThrusterEffector3DList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonThrusterEffector3DList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) { 
                AddonThrusterEffector3D newThrusterEffector3D = new AddonThrusterEffector3D(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonThrusterEffector3DList.Add(newThrusterEffector3D);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.TorqueEffector1D) {
            AddonTorqueEffector1D newTorqueEffector1D = new AddonTorqueEffector1D(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonTorqueEffector1DList.Add(newTorqueEffector1D);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.TorqueEffector3D) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonTorqueEffector3DList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonTorqueEffector3DList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the Torque type
                AddonTorqueEffector3D newTorqueEffector3D = new AddonTorqueEffector3D(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonTorqueEffector3DList.Add(newTorqueEffector3D);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.MouthBasic) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonMouthBasicList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonMouthBasicList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the MouthBasic type
                AddonMouthBasic newMouthBasic = new AddonMouthBasic(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonMouthBasicList.Add(newMouthBasic);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.NoiseMakerBasic) {
            AddonNoiseMakerBasic newNoiseMakerBasic = new AddonNoiseMakerBasic(sourceNode.ID, GetNextAddonInnov());
            critterConstructorManager.masterCritter.masterCritterGenome.addonNoiseMakerBasicList.Add(newNoiseMakerBasic);
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.Sticky) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonStickyList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonStickyList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the Sticky type
                AddonSticky newSticky = new AddonSticky(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonStickyList.Add(newSticky);
            }
        }
        else if (addonType == CritterNodeAddonBase.CritterNodeAddonTypes.WeaponBasic) {
            bool listContainsType = false;
            for (int i = 0; i < critterConstructorManager.masterCritter.masterCritterGenome.addonWeaponBasicList.Count; i++) {  // check for existing addon of this type
                if (critterConstructorManager.masterCritter.masterCritterGenome.addonWeaponBasicList[i].critterNodeID == sourceNode.ID) {
                    listContainsType = true;
                }
            }
            if (!listContainsType) {  // only allows 1 instance of the WeaponBasic type
                AddonWeaponBasic newWeaponBasic = new AddonWeaponBasic(sourceNode.ID, GetNextAddonInnov());
                critterConstructorManager.masterCritter.masterCritterGenome.addonWeaponBasicList.Add(newWeaponBasic);
            }
        }

        critterEditorUI.panelNodeAddons.panelAddonsList.GetComponent<PanelAddonsList>().RepopulateList(critterConstructorManager.masterCritter.masterCritterGenome, sourceNode.ID);
    }
Beispiel #11
0
    public void Prime(CritterGenome sourceGenome)
    {
        textHeader.text = sourceAddonType.ToString() + " [" + addonInno.ToString() + "]";

        if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.PhysicalAttributes)
        {
            AddonPhysicalAttributes physicalAttributes = sourceGenome.addonPhysicalAttributesList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Dynamic Friction:";
            floatDisplay1.sliderFloat.minValue = 0f;
            floatDisplay1.sliderFloat.maxValue = 1f;
            floatDisplay1.linkedFloatValue[0]  = physicalAttributes.dynamicFriction[0];
            physicalAttributes.dynamicFriction = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = physicalAttributes.dynamicFriction[0];
            floatDisplay1.textFloatValue.text  = physicalAttributes.dynamicFriction[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject             floatDisplay2GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay2   = floatDisplay2GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay2.textFloatName.text   = "Static Friction:";
            floatDisplay2.sliderFloat.minValue = 0f;
            floatDisplay2.sliderFloat.maxValue = 1f;
            floatDisplay2.linkedFloatValue[0]  = physicalAttributes.staticFriction[0];
            physicalAttributes.staticFriction  = floatDisplay2.linkedFloatValue;
            floatDisplay2.sliderFloat.value    = physicalAttributes.staticFriction[0];
            floatDisplay2.textFloatValue.text  = physicalAttributes.staticFriction[0].ToString();
            floatDisplay2GO.transform.SetParent(this.transform);

            GameObject             floatDisplay3GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay3   = floatDisplay3GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay3.textFloatName.text   = "Bounciness:";
            floatDisplay3.sliderFloat.minValue = 0f;
            floatDisplay3.sliderFloat.maxValue = 1f;
            floatDisplay3.linkedFloatValue[0]  = physicalAttributes.bounciness[0];
            physicalAttributes.bounciness      = floatDisplay3.linkedFloatValue;
            floatDisplay3.sliderFloat.value    = physicalAttributes.bounciness[0];
            floatDisplay3.textFloatValue.text  = physicalAttributes.bounciness[0].ToString();
            floatDisplay3GO.transform.SetParent(this.transform);

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text     = "Freeze Position X:";
            boolDisplay1.linkedBoolValue[0]    = physicalAttributes.freezePositionX[0];
            physicalAttributes.freezePositionX = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn       = physicalAttributes.freezePositionX[0];
            boolDisplay1GO.transform.SetParent(this.transform);

            GameObject            boolDisplay2GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay2   = boolDisplay2GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay2.textBoolName.text     = "Freeze Position Y:";
            boolDisplay2.linkedBoolValue[0]    = physicalAttributes.freezePositionY[0];
            physicalAttributes.freezePositionY = boolDisplay2.linkedBoolValue;
            boolDisplay2.toggleBool.isOn       = physicalAttributes.freezePositionY[0];
            boolDisplay2GO.transform.SetParent(this.transform);

            GameObject            boolDisplay3GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay3   = boolDisplay3GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay3.textBoolName.text     = "Freeze Position Z:";
            boolDisplay3.linkedBoolValue[0]    = physicalAttributes.freezePositionZ[0];
            physicalAttributes.freezePositionZ = boolDisplay3.linkedBoolValue;
            boolDisplay3.toggleBool.isOn       = physicalAttributes.freezePositionZ[0];
            boolDisplay3GO.transform.SetParent(this.transform);

            GameObject            boolDisplay4GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay4   = boolDisplay4GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay4.textBoolName.text     = "Freeze Rotation X:";
            boolDisplay4.linkedBoolValue[0]    = physicalAttributes.freezeRotationX[0];
            physicalAttributes.freezeRotationX = boolDisplay4.linkedBoolValue;
            boolDisplay4.toggleBool.isOn       = physicalAttributes.freezeRotationX[0];
            boolDisplay4GO.transform.SetParent(this.transform);

            GameObject            boolDisplay5GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay5   = boolDisplay5GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay5.textBoolName.text     = "Freeze Rotation Y:";
            boolDisplay5.linkedBoolValue[0]    = physicalAttributes.freezeRotationY[0];
            physicalAttributes.freezeRotationY = boolDisplay5.linkedBoolValue;
            boolDisplay5.toggleBool.isOn       = physicalAttributes.freezeRotationY[0];
            boolDisplay5GO.transform.SetParent(this.transform);

            GameObject            boolDisplay6GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay6   = boolDisplay6GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay6.textBoolName.text     = "Freeze Rotation Z:";
            boolDisplay6.linkedBoolValue[0]    = physicalAttributes.freezeRotationZ[0];
            physicalAttributes.freezeRotationZ = boolDisplay6.linkedBoolValue;
            boolDisplay6.toggleBool.isOn       = physicalAttributes.freezeRotationZ[0];
            boolDisplay6GO.transform.SetParent(this.transform);
        }

        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.JointAngleSensor)
        {
            AddonJointAngleSensor  jointAngleSensor = sourceGenome.addonJointAngleSensorList[sourceAddonIndex];
            GameObject             floatDisplayGO   = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay     = floatDisplayGO.GetComponent <PanelAddonDisplayFloat>();

            floatDisplay.textFloatName.text   = "Angle Sensitivity:";
            floatDisplay.sliderFloat.minValue = 0.01f;
            floatDisplay.sliderFloat.maxValue = 2f;
            floatDisplay.linkedFloatValue[0]  = jointAngleSensor.sensitivity[0];
            jointAngleSensor.sensitivity      = floatDisplay.linkedFloatValue;
            floatDisplay.sliderFloat.value    = jointAngleSensor.sensitivity[0];
            floatDisplay.textFloatValue.text  = jointAngleSensor.sensitivity[0].ToString();

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text  = "Measure Vel:";
            boolDisplay1.linkedBoolValue[0] = jointAngleSensor.measureVel[0];
            jointAngleSensor.measureVel     = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn    = jointAngleSensor.measureVel[0];
            boolDisplay1GO.transform.SetParent(this.transform);

            floatDisplayGO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.ContactSensor)
        {
            AddonContactSensor     contactSensor   = sourceGenome.addonContactSensorList[sourceAddonIndex];
            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.05f;
            floatDisplay1.sliderFloat.maxValue = 20f;
            floatDisplay1.linkedFloatValue[0]  = contactSensor.contactSensitivity[0];
            contactSensor.contactSensitivity   = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = contactSensor.contactSensitivity[0];
            floatDisplay1.textFloatValue.text  = contactSensor.contactSensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.RaycastSensor)
        {
            AddonRaycastSensor     raycastSensor   = sourceGenome.addonRaycastSensorList[sourceAddonIndex];
            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Max Distance:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 25f;
            floatDisplay1.linkedFloatValue[0]  = raycastSensor.maxDistance[0];
            raycastSensor.maxDistance          = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = raycastSensor.maxDistance[0];
            floatDisplay1.textFloatValue.text  = raycastSensor.maxDistance[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Forward Vector:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = raycastSensor.forwardVector[0].x;
            vector3Display.textXValue.text       = raycastSensor.forwardVector[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = raycastSensor.forwardVector[0].y;
            vector3Display.textYValue.text       = raycastSensor.forwardVector[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = raycastSensor.forwardVector[0].z;
            vector3Display.textZValue.text       = raycastSensor.forwardVector[0].z.ToString();
            vector3Display.linkedVector3Value[0] = raycastSensor.forwardVector[0];
            raycastSensor.forwardVector          = vector3Display.linkedVector3Value;
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.CompassSensor1D)
        {
            AddonCompassSensor1D compassSensor1D = sourceGenome.addonCompassSensor1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Forward Vector:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = compassSensor1D.forwardVector[0].x;
            vector3Display.textXValue.text       = compassSensor1D.forwardVector[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = compassSensor1D.forwardVector[0].y;
            vector3Display.textYValue.text       = compassSensor1D.forwardVector[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = compassSensor1D.forwardVector[0].z;
            vector3Display.textZValue.text       = compassSensor1D.forwardVector[0].z.ToString();
            vector3Display.linkedVector3Value[0] = compassSensor1D.forwardVector[0];
            compassSensor1D.forwardVector        = vector3Display.linkedVector3Value;

            vector3DisplayGO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.CompassSensor3D)
        {
            AddonCompassSensor3D compassSensor3D = sourceGenome.addonCompassSensor3DList[sourceAddonIndex];
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.PositionSensor1D)
        {
            AddonPositionSensor1D positionSensor1D = sourceGenome.addonPositionSensor1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Forward Vector:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = positionSensor1D.forwardVector[0].x;
            vector3Display.textXValue.text       = positionSensor1D.forwardVector[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = positionSensor1D.forwardVector[0].y;
            vector3Display.textYValue.text       = positionSensor1D.forwardVector[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = positionSensor1D.forwardVector[0].z;
            vector3Display.textZValue.text       = positionSensor1D.forwardVector[0].z.ToString();
            vector3Display.linkedVector3Value[0] = positionSensor1D.forwardVector[0];
            positionSensor1D.forwardVector       = vector3Display.linkedVector3Value;
            vector3DisplayGO.transform.SetParent(this.transform);

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = positionSensor1D.sensitivity[0];
            positionSensor1D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = positionSensor1D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = positionSensor1D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text  = "Relative:";
            boolDisplay1.linkedBoolValue[0] = positionSensor1D.relative[0];
            positionSensor1D.relative       = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn    = positionSensor1D.relative[0];
            boolDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.PositionSensor3D)
        {
            AddonPositionSensor3D positionSensor3D = sourceGenome.addonPositionSensor3DList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = positionSensor3D.sensitivity[0];
            positionSensor3D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = positionSensor3D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = positionSensor3D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text  = "Relative:";
            boolDisplay1.linkedBoolValue[0] = positionSensor3D.relative[0];
            positionSensor3D.relative       = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn    = positionSensor3D.relative[0];
            boolDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.RotationSensor1D)
        {
            AddonRotationSensor1D rotationSensor1D = sourceGenome.addonRotationSensor1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Local Axis:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = rotationSensor1D.localAxis[0].x;
            vector3Display.textXValue.text       = rotationSensor1D.localAxis[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = rotationSensor1D.localAxis[0].y;
            vector3Display.textYValue.text       = rotationSensor1D.localAxis[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = rotationSensor1D.localAxis[0].z;
            vector3Display.textZValue.text       = rotationSensor1D.localAxis[0].z.ToString();
            vector3Display.linkedVector3Value[0] = rotationSensor1D.localAxis[0];
            rotationSensor1D.localAxis           = vector3Display.linkedVector3Value;
            vector3DisplayGO.transform.SetParent(this.transform);

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = rotationSensor1D.sensitivity[0];
            rotationSensor1D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = rotationSensor1D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = rotationSensor1D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.RotationSensor3D)
        {
            AddonRotationSensor3D rotationSensor3D = sourceGenome.addonRotationSensor3DList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = rotationSensor3D.sensitivity[0];
            rotationSensor3D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = rotationSensor3D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = rotationSensor3D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.VelocitySensor1D)
        {
            AddonVelocitySensor1D velocitySensor1D = sourceGenome.addonVelocitySensor1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Forward Vector:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = velocitySensor1D.forwardVector[0].x;
            vector3Display.textXValue.text       = velocitySensor1D.forwardVector[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = velocitySensor1D.forwardVector[0].y;
            vector3Display.textYValue.text       = velocitySensor1D.forwardVector[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = velocitySensor1D.forwardVector[0].z;
            vector3Display.textZValue.text       = velocitySensor1D.forwardVector[0].z.ToString();
            vector3Display.linkedVector3Value[0] = velocitySensor1D.forwardVector[0];
            velocitySensor1D.forwardVector       = vector3Display.linkedVector3Value;
            vector3DisplayGO.transform.SetParent(this.transform);

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = velocitySensor1D.sensitivity[0];
            velocitySensor1D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = velocitySensor1D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = velocitySensor1D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text  = "Relative:";
            boolDisplay1.linkedBoolValue[0] = velocitySensor1D.relative[0];
            velocitySensor1D.relative       = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn    = velocitySensor1D.relative[0];
            boolDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.VelocitySensor3D)
        {
            AddonVelocitySensor3D velocitySensor3D = sourceGenome.addonVelocitySensor3DList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = velocitySensor3D.sensitivity[0];
            velocitySensor3D.sensitivity       = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = velocitySensor3D.sensitivity[0];
            floatDisplay1.textFloatValue.text  = velocitySensor3D.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject            boolDisplay1GO = (GameObject)Instantiate(boolDisplayPrefab);
            PanelAddonDisplayBool boolDisplay1   = boolDisplay1GO.GetComponent <PanelAddonDisplayBool>();
            boolDisplay1.textBoolName.text  = "Relative:";
            boolDisplay1.linkedBoolValue[0] = velocitySensor3D.relative[0];
            velocitySensor3D.relative       = boolDisplay1.linkedBoolValue;
            boolDisplay1.toggleBool.isOn    = velocitySensor3D.relative[0];
            boolDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.Altimeter)
        {
            AddonAltimeter altimeter = sourceGenome.addonAltimeterList[sourceAddonIndex];
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.EarBasic)
        {
            AddonEarBasic earBasic = sourceGenome.addonEarBasicList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Sensitivity:";
            floatDisplay1.sliderFloat.minValue = 0.01f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = earBasic.sensitivity[0];
            earBasic.sensitivity              = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value   = earBasic.sensitivity[0];
            floatDisplay1.textFloatValue.text = earBasic.sensitivity[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.Gravity)
        {
            AddonGravitySensor gravitySensor = sourceGenome.addonGravitySensorList[sourceAddonIndex];
        }

        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.JointMotor)
        {
            AddonJointMotor        jointMotor      = sourceGenome.addonJointMotorList[sourceAddonIndex];
            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Motor Force:";
            floatDisplay1.sliderFloat.minValue = 1f;
            floatDisplay1.sliderFloat.maxValue = 500f;
            floatDisplay1.linkedFloatValue[0]  = jointMotor.motorForce[0];
            jointMotor.motorForce             = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value   = jointMotor.motorForce[0];
            floatDisplay1.textFloatValue.text = jointMotor.motorForce[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject             floatDisplay2GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay2   = floatDisplay2GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay2.textFloatName.text   = "Motor Speed:";
            floatDisplay2.sliderFloat.minValue = 1f;
            floatDisplay2.sliderFloat.maxValue = 500f;
            floatDisplay2.linkedFloatValue[0]  = jointMotor.motorSpeed[0];
            jointMotor.motorSpeed             = floatDisplay2.linkedFloatValue;
            floatDisplay2.sliderFloat.value   = jointMotor.motorSpeed[0];
            floatDisplay2.textFloatValue.text = jointMotor.motorSpeed[0].ToString();
            floatDisplay2GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.ThrusterEffector1D)
        {
            AddonThrusterEffector1D thrusterEffector1D = sourceGenome.addonThrusterEffector1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Forward Vector:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = thrusterEffector1D.forwardVector[0].x;
            vector3Display.textXValue.text       = thrusterEffector1D.forwardVector[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = thrusterEffector1D.forwardVector[0].y;
            vector3Display.textYValue.text       = thrusterEffector1D.forwardVector[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = thrusterEffector1D.forwardVector[0].z;
            vector3Display.textZValue.text       = thrusterEffector1D.forwardVector[0].z.ToString();
            vector3Display.linkedVector3Value[0] = thrusterEffector1D.forwardVector[0];
            thrusterEffector1D.forwardVector     = vector3Display.linkedVector3Value;
            vector3DisplayGO.transform.SetParent(this.transform);

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Max Force:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 100f;
            floatDisplay1.linkedFloatValue[0]  = thrusterEffector1D.maxForce[0];
            thrusterEffector1D.maxForce        = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = thrusterEffector1D.maxForce[0];
            floatDisplay1.textFloatValue.text  = thrusterEffector1D.maxForce[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.ThrusterEffector3D)
        {
            AddonThrusterEffector3D thrusterEffector3D = sourceGenome.addonThrusterEffector3DList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Max Force:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 100f;
            floatDisplay1.linkedFloatValue[0]  = thrusterEffector3D.maxForce[0];
            thrusterEffector3D.maxForce        = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = thrusterEffector3D.maxForce[0];
            floatDisplay1.textFloatValue.text  = thrusterEffector3D.maxForce[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.TorqueEffector1D)
        {
            AddonTorqueEffector1D torqueEffector1D = sourceGenome.addonTorqueEffector1DList[sourceAddonIndex];

            GameObject vector3DisplayGO             = (GameObject)Instantiate(vector3DisplayPrefab);
            PanelAddonDisplayVector3 vector3Display = vector3DisplayGO.GetComponent <PanelAddonDisplayVector3>();
            vector3Display.textVector3Name.text  = "Axis:";
            vector3Display.sliderX.minValue      = -1f;
            vector3Display.sliderX.maxValue      = 1f;
            vector3Display.sliderX.value         = torqueEffector1D.axis[0].x;
            vector3Display.textXValue.text       = torqueEffector1D.axis[0].x.ToString();
            vector3Display.sliderY.minValue      = -1f;
            vector3Display.sliderY.maxValue      = 1f;
            vector3Display.sliderY.value         = torqueEffector1D.axis[0].y;
            vector3Display.textYValue.text       = torqueEffector1D.axis[0].y.ToString();
            vector3Display.sliderZ.minValue      = -1f;
            vector3Display.sliderZ.maxValue      = 1f;
            vector3Display.sliderZ.value         = torqueEffector1D.axis[0].z;
            vector3Display.textZValue.text       = torqueEffector1D.axis[0].z.ToString();
            vector3Display.linkedVector3Value[0] = torqueEffector1D.axis[0];
            torqueEffector1D.axis = vector3Display.linkedVector3Value;
            vector3DisplayGO.transform.SetParent(this.transform);

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Max Torque:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 100f;
            floatDisplay1.linkedFloatValue[0]  = torqueEffector1D.maxTorque[0];
            torqueEffector1D.maxTorque         = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = torqueEffector1D.maxTorque[0];
            floatDisplay1.textFloatValue.text  = torqueEffector1D.maxTorque[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.TorqueEffector3D)
        {
            AddonTorqueEffector3D torqueEffector3D = sourceGenome.addonTorqueEffector3DList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Max Torque:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 100f;
            floatDisplay1.linkedFloatValue[0]  = torqueEffector3D.maxTorque[0];
            torqueEffector3D.maxTorque         = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = torqueEffector3D.maxTorque[0];
            floatDisplay1.textFloatValue.text  = torqueEffector3D.maxTorque[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.MouthBasic)
        {
            AddonMouthBasic mouthBasic = sourceGenome.addonMouthBasicList[sourceAddonIndex];
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.NoiseMakerBasic)
        {
            AddonNoiseMakerBasic noiseMakerBasic = sourceGenome.addonNoiseMakerBasicList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Amplitude:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = noiseMakerBasic.amplitude[0];
            noiseMakerBasic.amplitude          = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = noiseMakerBasic.amplitude[0];
            floatDisplay1.textFloatValue.text  = noiseMakerBasic.amplitude[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.Sticky)
        {
            AddonSticky sticky = sourceGenome.addonStickyList[sourceAddonIndex];
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.WeaponBasic)
        {
            AddonWeaponBasic weaponBasic = sourceGenome.addonWeaponBasicList[sourceAddonIndex];

            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Strength:";
            floatDisplay1.sliderFloat.minValue = 0.1f;
            floatDisplay1.sliderFloat.maxValue = 10f;
            floatDisplay1.linkedFloatValue[0]  = weaponBasic.strength[0];
            weaponBasic.strength              = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value   = weaponBasic.strength[0];
            floatDisplay1.textFloatValue.text = weaponBasic.strength[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }

        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.OscillatorInput)
        {
            AddonOscillatorInput   oscillatorInput = sourceGenome.addonOscillatorInputList[sourceAddonIndex];
            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Frequency:";
            floatDisplay1.sliderFloat.minValue = 0.05f;
            floatDisplay1.sliderFloat.maxValue = 20f;
            floatDisplay1.linkedFloatValue[0]  = oscillatorInput.frequency[0];
            oscillatorInput.frequency          = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value    = oscillatorInput.frequency[0];
            floatDisplay1.textFloatValue.text  = oscillatorInput.frequency[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);

            GameObject             floatDisplay2GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay2   = floatDisplay2GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay2.textFloatName.text   = "Amplitude:";
            floatDisplay2.sliderFloat.minValue = 0.05f;
            floatDisplay2.sliderFloat.maxValue = 20f;
            floatDisplay2.linkedFloatValue[0]  = oscillatorInput.amplitude[0];
            oscillatorInput.amplitude          = floatDisplay2.linkedFloatValue;
            floatDisplay2.sliderFloat.value    = oscillatorInput.amplitude[0];
            floatDisplay2.textFloatValue.text  = oscillatorInput.amplitude[0].ToString();
            floatDisplay2GO.transform.SetParent(this.transform);

            GameObject             floatDisplay3GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay3   = floatDisplay3GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay3.textFloatName.text   = "Offset:";
            floatDisplay3.sliderFloat.minValue = -20f;
            floatDisplay3.sliderFloat.maxValue = 20f;
            floatDisplay3.linkedFloatValue[0]  = oscillatorInput.offset[0];
            oscillatorInput.offset             = floatDisplay3.linkedFloatValue;
            floatDisplay3.sliderFloat.value    = oscillatorInput.offset[0];
            floatDisplay3.textFloatValue.text  = oscillatorInput.offset[0].ToString();
            floatDisplay3GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.ValueInput)
        {
            AddonValueInput        valueInput      = sourceGenome.addonValueInputList[sourceAddonIndex];
            GameObject             floatDisplay1GO = (GameObject)Instantiate(floatDisplayPrefab);
            PanelAddonDisplayFloat floatDisplay1   = floatDisplay1GO.GetComponent <PanelAddonDisplayFloat>();
            floatDisplay1.textFloatName.text   = "Value:";
            floatDisplay1.sliderFloat.minValue = -5f;
            floatDisplay1.sliderFloat.maxValue = 5f;
            floatDisplay1.linkedFloatValue[0]  = valueInput.value[0];
            valueInput.value = floatDisplay1.linkedFloatValue;
            floatDisplay1.sliderFloat.value   = valueInput.value[0];
            floatDisplay1.textFloatValue.text = valueInput.value[0].ToString();
            floatDisplay1GO.transform.SetParent(this.transform);
        }
        else if (sourceAddonType == CritterNodeAddonBase.CritterNodeAddonTypes.TimerInput)
        {
            AddonTimerInput timerInput = sourceGenome.addonTimerInputList[sourceAddonIndex];
        }
    }