示例#1
0
    // Acessório Gráfico de Iniciaização
    void LimitGrid()
    {
        Vector3 edge = new Vector3(gridSize.x * tile.Size.x, 0, gridSize.y * tile.Size.z);

        border[0] = Vector3.zero;
        border[1] = new Vector3(0, 0, edge.z);
        border[2] = edge;
        border[3] = new Vector3(edge.x, 0, 0);

        center = (border[2] / 2);

        floor = new GameObject("Floor");
        floor.transform.position = center;


        CustomGraphical.DrawStripeFrame(border[0], border[1], border[2], border[3], new float[2] {
            5, margin
        }, new Color[2] {
            Color.yellow, Color.grey
        })
        .transform.SetParent(floor.transform);

        CustomGraphical.DrawChessQuad(border[0], border[1], border[2], border[3], gridSize, new Color[2] {
            new Color(0.1f, 0.2f, 0.1f), new Color(0.6f, 0.6f, 0.7f)
        })
        .transform.SetParent(floor.transform);
    }
    public static GameObject DrawFrame(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float margin, Color col)
    {
        GameObject frame = new GameObject("Frame");

        frame.transform.position = p0;

        Vector3[] marginBorder = new Vector3[4] {
            new Vector3(-margin, 0, -margin),
            p1 - p0 + new Vector3(-margin, 0, margin),
            p2 - p0 + new Vector3(margin, 0, margin),
            p3 - p0 + new Vector3(margin, 0, -margin)
        };


        CustomGraphical.DrawQuad(p1, marginBorder[1], marginBorder[2], p2, col).transform.SetParent(frame.transform);
        CustomGraphical.DrawQuad(p2, marginBorder[2], marginBorder[3], p3, col).transform.SetParent(frame.transform);
        CustomGraphical.DrawQuad(p3, marginBorder[3], marginBorder[0], p0, col).transform.SetParent(frame.transform);
        CustomGraphical.DrawQuad(p0, marginBorder[0], marginBorder[1], p1, col).transform.SetParent(frame.transform);

        return(frame);
    }