예제 #1
0
    public void clean()
    {
        if (lineList4Grid != null)
        {
            for (int i = 0; i < lineList4Grid.Count; i++)
            {
                DestroyImmediate(((LineRenderer)(lineList4Grid[i])).gameObject, true);
            }
        }
        lineList4Grid = null;

        for (int i = 0; i < lineList4Rect.Count; i++)
        {
            CLThingsPool.returnObj(((LineRenderer)(lineList4Rect[i])).gameObject);
            NGUITools.SetActive(((LineRenderer)(lineList4Rect[i])).gameObject, false);
        }
        lineList4Rect.Clear();
        Transform tr = null;

        while (transform.childCount > 0)
        {
            tr = transform.GetChild(0);
            CLThingsPool.returnObj(lineName, tr.gameObject);
            NGUITools.SetActive(tr.gameObject, false);
        }
        tr = null;
        if (linePrefab != null)
        {
            CLThingsPool.returnObj(lineName, linePrefab.gameObject);
            NGUITools.SetActive(linePrefab.gameObject, false);
            linePrefab = null;
        }
        isShowingGrid = false;
    }
예제 #2
0
    public void showRect()
    {
        if (lineList4Rect.Count > 0)
        {
            for (int i = 0; i < lineList4Rect.Count; i++)
            {
                CLThingsPool.returnObj(((LineRenderer)(lineList4Rect[i])).gameObject);
                NGUITools.SetActive(((LineRenderer)(lineList4Rect[i])).gameObject, false);
            }
            //return;
            lineList4Rect.Clear();
        }
        float   width  = (numGroundCols * cellSize);
        float   height = (numGroundRows * cellSize);
        Vector3 origin = originPos - new Vector3((numGroundRows - numRows), 0, (numGroundCols - numCols));

        Vector3 startPos = origin + 0 * cellSize * Utl.kZAxis;

        startPos.y = gridLineHight;
        Vector3 endPos = startPos + width * Utl.kXAxis + Vector3.up * gridLineHight;

        endPos.y = gridLineHight;
        drawLine(startPos, endPos, color4Rect);
        startPos = origin + numGroundRows * cellSize * Utl.kZAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        endPos   = startPos + width * Utl.kXAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        drawLine(startPos, endPos, color4Rect);

        startPos = origin + 0 * cellSize * Utl.kXAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        endPos   = startPos + height * Utl.kZAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        drawLine(startPos, endPos, color4Rect);
        startPos = origin + numGroundCols * cellSize * Utl.kXAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        endPos   = startPos + height * Utl.kZAxis + Vector3.up * gridLineHight;
        endPos.y = gridLineHight;
        drawLine(startPos, endPos, color4Rect);
    }