Exemplo n.º 1
0
    void EndGeneration()
    {
        List <Organism> remaining = Organisms.OrderByDescending(x => x.MaxDistance)
                                    .Take(Mathf.RoundToInt(survivors * ammount))
                                    .ToList();

        currentGenerationData.MaxDistance = remaining [0].MaxDistance;
        currentGenerationData.SetDistances(Organisms);
        currentGenerationData.SetSurvivors(remaining);

        for (int i = 0; i < Organisms.Count; i++)
        {
            Organisms [i].Kill();
        }

        Simulate(currentGenerationData.GetSurvivors());
    }