示例#1
0
    public void SetNewOrganism(Organism other)
    {
        this.generation = other.Generation;
        this.id         = other.Id;
        this.name       = other.name;
        this.DNA        = other.DNA;
        Renderer rend = GetComponent <Renderer>();

        rend.material.color = PopGen.ColorAlleleToColor(dna["color"]);
        fitness             = other.fitness;
        parents             = other.parents;
    }
示例#2
0
    //Generate organisms "DNA" and other attributes
    private Organism SetupOrganism(Organism organism)
    {
        organism.Waypoints            = waypoints;
        organism.DestinationThreshold = simManager.destinationThreshold;
        organism.MoveSpeed            = simManager.moveSpeed;
        organism.WanderWaitTime       = simManager.wanderWaitTime;

        organism.Generation = currentGeneration;
        organism.Id         = PopGen.MakeId(currentGeneration, currentSize);
        organism.name       = PopGen.MakeOrganismName();
        organism.DNA        = PopGen.MakeOrganismDNA();

        Renderer rend = organism.GetComponent <Renderer>();

        rend.material       = new Material(Shader.Find("Standard"));
        rend.material.color = PopGen.ColorAlleleToColor(organism.DNA["color"]);

        organism.Fitness = PopGen.EvaluateFitness("color", organism.DNA["color"]);
        organism.Parents = new string[] { "?????-?????", "?????-?????" };
        return(organism);
    }