Example #1
0
    void MakeTerrain()
    {
        List<int> list = new List<int>();
        Terrain.ForEach(x => list.Add(x.Weight));

        WeightedRandomizer randomizer = new WeightedRandomizer(list);
        foreach (WorldMapHexagonTileData tileData in DataCarrier.PersistentData.WorldRepresentation.Values)
        {
            int ran = randomizer.GetRandomIndex();
            WorldMapTerrainDefinition def = Terrain[ran];
            tileData.Terrain = def;
        }
    }