/// <summary> /// Creates the triangles for all of the tiles. /// </summary> /// <param name="tiles">The tiles to tessellate.</param> /// <param name="tessellator">The tessellator used to draw the mesh.</param> protected override void RebuildMesh(Tile[] tiles, Tessellator tessellator) { foreach (Tile tile in tiles) { tessellator.Tessellate2D(tile.transform.localPosition, Tile.OUTER_RADIUS, tile.type.color); } }
/// <summary> /// Creates the triangles for all of the tiles. /// </summary> /// <param name="tileRanges">The tile ranges to tessellate.</param> /// <param name="tessellator">The tessellator used to draw the mesh.</param> protected override void RebuildMesh(TileBorder[] tileRanges, Tessellator tessellator) { foreach (TileBorder tile in tileRanges) { tessellator.Tessellate2D(tile.coordinates.position, Tile.OUTER_RADIUS + 2f, 2f, tile.edge, World.selectedUnit.type.color); } }
protected override void RebuildMesh( Province[] provinces, Tessellator tessellator ) { foreach ( Province province in provinces ) { foreach ( Tile t in province.property ) { for ( int i = 0; i < t.neighbors.Length; i++ ) { Tile neighbor = t.neighbors[ i ]; // don't draw a border here // if the tile doesn't exist OR the tile isn't owned by this faction // (the faction border will be drawn here) // OR if the tile is still owned by this province if ( neighbor == null || neighbor.faction != province.faction || neighbor.province == province ) continue; // draw the province's border in black to set it off from other province territories tessellator.Tessellate2D( t.coordinates.position, Tile.OUTER_RADIUS + 0.5f, 0.5f, ( TileEdge ) i, province.faction.secondaryColor ); } } } }
protected override void RebuildMesh(Faction[] factions, Tessellator tessellator) { // find and draw the borders of each faction foreach (Faction faction in factions) { // find the borders and draw the lines foreach (Tile t in faction.tiles) { for (int i = 0; i < t.neighbors.Length; i++) { Tile neighbor = t.neighbors[i]; // if the tile exists AND is owned by this faction, skip it if (neighbor != null && neighbor.faction == faction) { continue; } // this is a border edge, draw it now! tessellator.Tessellate2D(t.coordinates.position, Tile.OUTER_RADIUS + 2f, 2f, ( TileEdge )i, faction.primaryColor); } } } }