Ejemplo n.º 1
0
    public static GameObject AddDebugLine(Vector3 pos, Vector3 pos2, Color co, string strTag = "", float fLastTime = float.MaxValue, bool autoHide = false)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load("DebugLineRender")) as GameObject;

        obj.transform.position = (pos + pos2) / 2;
        LineRenderer line = obj.GetComponent <LineRenderer>();

        line.startWidth   = line.endWidth = 0.1f;
        line.startColor   = line.endColor = co;
        line.numPositions = 2;
        line.SetPosition(0, pos);
        line.SetPosition(1, pos2);
        UITalkBubble text = obj.GetComponent <UITalkBubble>();

        if (text == null)
        {
            text          = obj.AddComponent <UITalkBubble>();
            text.AutoHide = autoHide;
        }
        text.strText  = strTag;
        text.showtime = fLastTime;
        text.SetDebugText();
        int nCount = DebugLine.Count;

        if (removeNodeIndex.Count != 0)
        {
            nCount = removeNodeIndex[0];
            removeNodeIndex.RemoveAt(0);
        }
        DebugLine.Add(obj);
        return(obj);
    }
Ejemplo n.º 2
0
    public static int AddDebugLine(Vector3 pos, Color co, string strTag = "", float fLastTime = float.MaxValue)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load("DebugLineRender")) as GameObject;

        obj.transform.position = pos;
        LineRenderer line = obj.GetComponent <LineRenderer>();

        line.SetWidth(1, 1);
        line.SetColors(co, co);
        line.SetVertexCount(2);
        line.SetPosition(0, pos);
        line.SetPosition(1, pos + Vector3.up * 15);
        UITalkBubble text = obj.GetComponent <UITalkBubble>();

        if (text == null)
        {
            text = obj.AddComponent <UITalkBubble>();
        }
        text.strText  = strTag;
        text.showtime = fLastTime;
        text.SetDebugText();
        int nCount = DebugLine.Count;

        if (removeNodeIndex.Count != 0)
        {
            nCount = removeNodeIndex[0];
            removeNodeIndex.RemoveAt(0);
        }
        DebugLine.Add(nCount, obj);
        return(nCount);
    }