Exemple #1
0
    public void Initialize(ValueInputGenome genome, Agent agent)
    {
        //Debug.Log("InputValue(ValueInputGenome genome)");
        parentID  = genome.parentID;
        inno      = genome.inno;
        isVisible = agent.isVisible;

        value    = new float[1];
        value[0] = genome.val;
    }
Exemple #2
0
 public ValueInputGenome(ValueInputGenome template)
 {
     this.parentID = template.parentID;
     this.inno     = template.inno;
     this.val      = template.val;
 }
Exemple #3
0
    public void CopyBodyGenomeFromTemplate(BodyGenome templateGenome)
    {
        // This method creates a clone of the provided BodyGenome - should have no shared references!!!

        bodyType = templateGenome.bodyType;
        // copy module lists:
        atmosphereSensorList = new List <AtmosphereSensorGenome>();
        for (int i = 0; i < templateGenome.atmosphereSensorList.Count; i++)
        {
            AtmosphereSensorGenome genomeCopy = new AtmosphereSensorGenome(templateGenome.atmosphereSensorList[i]);
            atmosphereSensorList.Add(genomeCopy);
        }
        basicJointList = new List <BasicJointGenome>();
        for (int i = 0; i < templateGenome.basicJointList.Count; i++)
        {
            BasicJointGenome genomeCopy = new BasicJointGenome(templateGenome.basicJointList[i]);
            basicJointList.Add(genomeCopy);
        }
        basicWheelList = new List <BasicWheelGenome>();
        for (int i = 0; i < templateGenome.basicWheelList.Count; i++)
        {
            BasicWheelGenome genomeCopy = new BasicWheelGenome(templateGenome.basicWheelList[i]);
            basicWheelList.Add(genomeCopy);
        }
        contactSensorList = new List <ContactGenome>();
        for (int i = 0; i < templateGenome.contactSensorList.Count; i++)
        {
            ContactGenome genomeCopy = new ContactGenome(templateGenome.contactSensorList[i]);
            contactSensorList.Add(genomeCopy);
        }
        gravitySensorList = new List <GravitySensorGenome>();
        for (int i = 0; i < templateGenome.gravitySensorList.Count; i++)
        {
            GravitySensorGenome genomeCopy = new GravitySensorGenome(templateGenome.gravitySensorList[i]);
            gravitySensorList.Add(genomeCopy);
        }
        healthModuleList = new List <HealthGenome>();
        for (int i = 0; i < templateGenome.healthModuleList.Count; i++)
        {
            HealthGenome genomeCopy = new HealthGenome(templateGenome.healthModuleList[i]);
            healthModuleList.Add(genomeCopy);
        }
        oscillatorInputList = new List <OscillatorGenome>();
        for (int i = 0; i < templateGenome.oscillatorInputList.Count; i++)
        {
            OscillatorGenome genomeCopy = new OscillatorGenome(templateGenome.oscillatorInputList[i]);
            oscillatorInputList.Add(genomeCopy);
        }
        raycastSensorList = new List <RaycastSensorGenome>();
        for (int i = 0; i < templateGenome.raycastSensorList.Count; i++)
        {
            RaycastSensorGenome genomeCopy = new RaycastSensorGenome(templateGenome.raycastSensorList[i]);
            raycastSensorList.Add(genomeCopy);
        }
        shieldList = new List <ShieldGenome>();
        for (int i = 0; i < templateGenome.shieldList.Count; i++)
        {
            ShieldGenome genomeCopy = new ShieldGenome(templateGenome.shieldList[i]);
            shieldList.Add(genomeCopy);
        }
        targetSensorList = new List <TargetSensorGenome>();
        for (int i = 0; i < templateGenome.targetSensorList.Count; i++)
        {
            TargetSensorGenome genomeCopy = new TargetSensorGenome(templateGenome.targetSensorList[i]);
            targetSensorList.Add(genomeCopy);
        }
        thrusterList = new List <ThrusterGenome>();
        for (int i = 0; i < templateGenome.thrusterList.Count; i++)
        {
            ThrusterGenome genomeCopy = new ThrusterGenome(templateGenome.thrusterList[i]);
            thrusterList.Add(genomeCopy);
        }
        torqueList = new List <TorqueGenome>();
        for (int i = 0; i < templateGenome.torqueList.Count; i++)
        {
            TorqueGenome genomeCopy = new TorqueGenome(templateGenome.torqueList[i]);
            torqueList.Add(genomeCopy);
        }
        trajectorySensorList = new List <TrajectorySensorGenome>();
        for (int i = 0; i < templateGenome.trajectorySensorList.Count; i++)
        {
            TrajectorySensorGenome genomeCopy = new TrajectorySensorGenome(templateGenome.trajectorySensorList[i]);
            trajectorySensorList.Add(genomeCopy);
        }
        valueInputList = new List <ValueInputGenome>();
        for (int i = 0; i < templateGenome.valueInputList.Count; i++)
        {
            ValueInputGenome genomeCopy = new ValueInputGenome(templateGenome.valueInputList[i]);
            valueInputList.Add(genomeCopy);
        }
        weaponProjectileList = new List <WeaponProjectileGenome>();
        for (int i = 0; i < templateGenome.weaponProjectileList.Count; i++)
        {
            WeaponProjectileGenome genomeCopy = new WeaponProjectileGenome(templateGenome.weaponProjectileList[i]);
            weaponProjectileList.Add(genomeCopy);
        }
        weaponTazerList = new List <WeaponTazerGenome>();
        for (int i = 0; i < templateGenome.weaponTazerList.Count; i++)
        {
            WeaponTazerGenome genomeCopy = new WeaponTazerGenome(templateGenome.weaponTazerList[i]);
            weaponTazerList.Add(genomeCopy);
        }
    }