Example #1
0
    private void MarkIslandSegment(IslandTile tile, int id)
    {
        if (tile.IsWater || id == tile.islandId)
        {
            return;
        }

        if (tile.islandId == 99 || tile.islandId < id)
        {
            if (tile.islandId < id)
            {
                subIslands.Remove(id);
                id = tile.islandId;
            }

            tile.islandId = id;

            if (!subIslands.ContainsKey(id))
            {
                subIslands[id] = new List <IslandTile>();
            }

            subIslands[id].Add(tile);

            foreach (Vector v in tile.neighbors)
            {
                IslandTile nt = islandTiles[IslandTile.VToV3(v)];
                MarkIslandSegment(nt, id);
            }
        }
    }
Example #2
0
    private void GenerateTiles()
    {
        islandTiles = new Dictionary <Vector3, IslandTile>();

        foreach (Vector v in cellVectors)
        {
            if (VectorIsInfinite(v))
            {
                continue;
            }

            IslandTile t = new IslandTile(v, vGraph, this);
            islandTiles.Add(IslandTile.VToV3(v), t);
        }
    }
Example #3
0
    void SetupGizmos()
    {
        vGridLineGizmos = new List <Vector3[]>();

        foreach (VoronoiEdge e in vGraph.Edges)
        {
            Vector3[] edgeLine = new Vector3[2]
            {
                IslandTile.VToV3(e.VVertexA),
                IslandTile.VToV3(e.VVertexB)
            };

            vGridLineGizmos.Add(edgeLine);
        }
    }
Example #4
0
 private static bool VectorIsInfinite(Vector v)
 {
     return(VectorIsInfinite(IslandTile.VToV3(v)));
 }
Example #5
0
 private static bool IsClockwise(Vector a, Vector b, Vector c)
 {
     return(IsClockwise(IslandTile.VToV3(a),
                        IslandTile.VToV3(b),
                        IslandTile.VToV3(c)));
 }