Beispiel #1
0
    PlayerPopulationData GetReplatePopulation(int player, int sampleSize)
    {
        PlayerPopulationData pop = new PlayerPopulationData();
        float perTile            = sampleSize / 16f;
        int   soFar = 0;

        Tile[] tiles = GetComponentsInChildren <Tile>();
        while (soFar < sampleSize)
        {
            for (int i = 0; i < tiles.Length; i++)
            {
                int sample = Mathf.Min(Mathf.FloorToInt(perTile), sampleSize - soFar);
                int resultingSample;
                pop.Add(tiles[i].GetSubSample(player, sample, out resultingSample));
                soFar += resultingSample;
                if (soFar >= sampleSize)
                {
                    break;
                }
            }
        }
        return(pop);
    }
 public void AddMigrants(PlayerPopulationData migrants)
 {
     data.Add(migrants);
 }