예제 #1
0
 public RegionTile(WorldMap remoteMap, int index)
 {
     elevation = remoteMap.elevation[index];
     if (remoteMap.water_elevation != null && remoteMap.water_elevation.Count > index)
         water_elevation = remoteMap.water_elevation[index];
     else
         water_elevation = 99;
     rainfall = remoteMap.rainfall[index];
     vegetation = remoteMap.vegetation[index];
     temperature = remoteMap.temperature[index];
     evilness = remoteMap.evilness[index];
     drainage = remoteMap.drainage[index];
     volcanism = remoteMap.volcanism[index];
     savagery = remoteMap.savagery[index];
     salinity = remoteMap.salinity[index];
     if (remoteMap.river_tiles != null && remoteMap.river_tiles.Count > index)
         rivers = remoteMap.river_tiles[index];
 }
예제 #2
0
    private void AddRiverTile(Sides riverSides, RiverTile riverTile, Vector3 vert1, Vector2 biome, float north, float east, float south, float west)
    {
        Vector3[,] verts = new Vector3[4,4];

        int waterLevel = int.MaxValue;

        if (riverTile.north.min_pos >= 0)
            waterLevel = Mathf.Min(riverTile.north.elevation, waterLevel);
        if (riverTile.east.min_pos >= 0)
            waterLevel = Mathf.Min(riverTile.east.elevation, waterLevel);
        if (riverTile.south.min_pos >= 0)
            waterLevel = Mathf.Min(riverTile.south.elevation, waterLevel);
        if (riverTile.west.min_pos >= 0)
            waterLevel = Mathf.Min(riverTile.west.elevation, waterLevel);

        //setup a few vertices that are used everywhere.
        verts[0, 0] = vert1;
        verts[3, 3] = vert1 + new Vector3(48 * GameMap.tileWidth, 0, -48 * GameMap.tileWidth);
        verts[0, 3] = new Vector3(verts[0, 0].x, verts[0, 0].y, verts[3, 3].z);
        verts[3, 0] = new Vector3(verts[3, 3].x, verts[0, 0].y, verts[0, 0].z);

        verts[1, 0] = verts[0, 0] + new Vector3(riverTile.north.min_pos * GameMap.tileWidth, 0, 0);
        verts[2, 0] = verts[0, 0] + new Vector3((riverTile.north.max_pos + 1) * GameMap.tileWidth, 0, 0);

        verts[1, 3] = verts[0, 3] + new Vector3(riverTile.south.min_pos * GameMap.tileWidth, 0, 0);
        verts[2, 3] = verts[0, 3] + new Vector3((riverTile.south.max_pos + 1) * GameMap.tileWidth, 0, 0);

        verts[0, 1] = verts[0, 0] + new Vector3(0, 0, -riverTile.west.min_pos * GameMap.tileWidth);
        verts[0, 2] = verts[0, 0] + new Vector3(0, 0, -(riverTile.west.max_pos + 1) * GameMap.tileWidth);

        verts[3, 1] = verts[3, 0] + new Vector3(0, 0, -riverTile.east.min_pos * GameMap.tileWidth);
        verts[3, 2] = verts[3, 0] + new Vector3(0, 0, -(riverTile.east.max_pos + 1) * GameMap.tileWidth);

        switch (riverSides)
        {
            case Sides.North | Sides.South:
                AddRiverStraight(verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], biome, waterLevel, north, east, south, west, riverTile.north.elevation, riverTile.south.elevation);
                break;
            case Sides.East | Sides.West:
                AddRiverStraight(verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], biome, waterLevel, east, south, west, north, riverTile.east.elevation, riverTile.west.elevation);
                break;
            case Sides.North:
                AddRiverEnd(verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 3], verts[0, 3], biome, waterLevel, north, east, south, west);
                break;
            case Sides.East:
                AddRiverEnd(verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[0, 3], verts[0, 0], biome, waterLevel, east, south, west, north);
                break;
            case Sides.South:
                AddRiverEnd(verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], verts[0, 0], verts[3, 0], biome, waterLevel, south, west, north, east);
                break;
            case Sides.West:
                AddRiverEnd(verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], verts[3, 0], verts[3, 3], biome, waterLevel, west, north, east, south);
                break;
            case Sides.North | Sides.East:
                AddRiverCorner(verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[0, 3], biome, waterLevel, north, east, south, west);
                break;
            case Sides.East | Sides.South:
                AddRiverCorner(verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], verts[0, 0], biome, waterLevel, east, south, west, north);
                break;
            case Sides.South | Sides.West:
                AddRiverCorner(verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], verts[3, 0], biome, waterLevel, south, west, north, east);
                break;
            case Sides.West | Sides.North:
                AddRiverCorner(verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 3], biome, waterLevel, west, north, east, south);
                break;
            case Sides.North | Sides.East | Sides.South:
                AddRiverTee(verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], biome, waterLevel, north, east, south, west, riverTile.north.elevation, riverTile.east.elevation, riverTile.south.elevation);
                break;
            case Sides.East | Sides.South | Sides.West:
                AddRiverTee(verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], biome, waterLevel, east, south, west, north, riverTile.east.elevation, riverTile.south.elevation, riverTile.west.elevation);
                break;
            case Sides.South | Sides.West | Sides.North:
                AddRiverTee(verts[3, 3], verts[2, 3], verts[1, 3], verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], biome, waterLevel, south, west, north, east, riverTile.south.elevation, riverTile.west.elevation, riverTile.north.elevation);
                break;
            case Sides.West | Sides.North | Sides.East:
                AddRiverTee(verts[0, 3], verts[0, 2], verts[0, 1], verts[0, 0], verts[1, 0], verts[2, 0], verts[3, 0], verts[3, 1], verts[3, 2], verts[3, 3], biome, waterLevel, west, north, east, south, riverTile.west.elevation, riverTile.north.elevation, riverTile.east.elevation);
                break;
            case Sides.North | Sides.East | Sides.South | Sides.West:
                break;
            default:
                break;
        }
    }
예제 #3
0
 public RegionTile(RemoteFortressReader.RegionTile tile)
 {
     elevation = tile.elevation;
     water_elevation = tile.water_elevation;
     rainfall = tile.rainfall;
     vegetation = tile.vegetation;
     temperature = tile.temperature;
     evilness = tile.evilness;
     drainage = tile.drainage;
     volcanism = tile.volcanism;
     savagery = tile.savagery;
     salinity = tile.salinity;
     rivers = tile.river_tiles;
     surfaceMaterial = tile.surface_material;
     plantMaterials = new List<MatPairStruct>();
     foreach (var item in tile.plant_materials)
     {
         plantMaterials.Add(item);
     }
     buildings = tile.buildings;
     stoneMaterials = new List<MatPairStruct>();
     foreach (var item in tile.stone_materials)
     {
         stoneMaterials.Add(item);
     }
     treeMaterials = new List<MatPairStruct>();
     foreach (var item in tile.tree_materials)
     {
         treeMaterials.Add(item);
     }
     snow = tile.snow;
 }