public Creature(Creature mother) { this.pos = mother.pos; this.viewAngle = (float)Random.Range(0, 360) * Mathf.PI * 2; this.brain = mother.brain.cloneFullMesh(); inBias = brain.getInputNeuronFromName(NAME_IN_BIAS); inFoodValuePosition = brain.getInputNeuronFromName(NAME_IN_FOODVALUEPOSITION); inFoodValueFeeler = brain.getInputNeuronFromName(NAME_IN_FOODVALUEFEELER); inOcclusionFeeler = brain.getInputNeuronFromName(NAME_IN_OCCLUSIONFEELER); inEnergy = brain.getInputNeuronFromName(NAME_IN_ENERGY); inAge = brain.getInputNeuronFromName(NAME_IN_AGE); inGeneticDifference = brain.getInputNeuronFromName(NAME_IN_GENETICDIFFERENCE); inWasAttacked = brain.getInputNeuronFromName(NAME_IN_WASATTACKED); inWaterOnFeeler = brain.getInputNeuronFromName(NAME_IN_WATERONFEELER); inWaterOnCreature = brain.getInputNeuronFromName(NAME_IN_WATERONCREATURE); outBirth = brain.getOutputNeuronFromName(NAME_OUT_BIRTH); outRotate = brain.getOutputNeuronFromName(NAME_OUT_ROTATE); outForward = brain.getOutputNeuronFromName(NAME_OUT_FORWARD); outFeelerangle = brain.getOutputNeuronFromName(NAME_OUT_FEELERANGLE); outAttack = brain.getOutputNeuronFromName(NAME_OUT_ATTACK); outEat = brain.getOutputNeuronFromName(NAME_OUT_EAT); // CalculateFeelerPos(); for (int i = 0; i < 10; i++) { brain.RandomMutation(0.1f); } float r = mother.color.r; float g = mother.color.g; float b = mother.color.b; r += Random.value * 0.1f - 0.05f; g += Random.value * 0.1f - 0.05f; b += Random.value * 0.1f - 0.05f; r = Mathf.Clamp(r, 0, 1); g = Mathf.Clamp(g, 0, 1); b = Mathf.Clamp(b, 0, 1); color = new Color(r, g, b); }
public void addInputNeuron(InputNeuron neuron) { inputNeurons.Add(neuron); }