Beispiel #1
0
    void CreateCell(int x, int z, int i, Block block)
    {
        SquareCell cell = cells[i] = Instantiate(cellPrefab);

        cell.point = block.Point;
        cell.block = block;

        cell.RefreshPosition();

        blocksToCellsMap.Add(block, cell);

        AddCellToChunk(x, z, cell);
    }
Beispiel #2
0
    void Triangulate(SquareDirection direction, SquareCell cell)
    {
        int zLevel = Camera.main.GetComponent <CameraController>().DisplayZ;

        cell.RefreshPosition();
        Vector3 center = cell.transform.localPosition;
        Vector3 v1     = center + SquareMetrics.GetFirstSolidCorner(direction);
        Vector3 v2     = center + SquareMetrics.GetSecondSolidCorner(direction);

        AddTriangle(center, v1, v2);
        AddTriangleColor(cell.Color);
        if (direction <= SquareDirection.E)
        {
            BuildBridge(direction, cell, v1, v2);
        }
        // From now on, we will only fill the hole from one direction
        // North, because it's the first
        if (direction == SquareDirection.N)
        {
            FillHole(cell, v2);
        }
    }