Ejemplo n.º 1
0
    // Outline a single hex
    public void OutlineHex(HexCoord hex)
    {
        outlineObject = (GameObject)Instantiate(outlinePrefab);
        LineRenderer lineRend    = outlineObject.GetComponent <LineRenderer>();
        int          vertexCount = 7;

        lineRend.SetVertexCount(vertexCount);
        int ind = 0;

        foreach (Vector2 pos in hex.Corners())
        {
            Vector3 pos3d = new Vector3(pos.x, pos.y, 0.02f);   //Offset in the z direction slightly above board
            lineRend.SetPosition(ind, pos3d);

            if (ind == 0)
            {
                lineRend.SetPosition(vertexCount - 1, pos3d); //Also set the end vertex the same as the start point
            }
            ind++;
        }
    }
Ejemplo n.º 2
0
    // Outline a single hex
    public void OutlineHex(HexCoord hex)
    {
        outlineObject = (GameObject)Instantiate(outlinePrefab);
        LineRenderer lineRend = outlineObject.GetComponent<LineRenderer>();
        int vertexCount = 7;
        lineRend.SetVertexCount(vertexCount);
        int ind = 0;
        foreach (Vector2 pos in hex.Corners()){
            Vector3 pos3d = new Vector3(pos.x, pos.y, 0.02f);   //Offset in the z direction slightly above board
            lineRend.SetPosition(ind, pos3d);

            if (ind == 0)
                lineRend.SetPosition(vertexCount-1, pos3d); //Also set the end vertex the same as the start point

            ind++;
        }
    }