예제 #1
0
    void DrawGuiGizmoAxis(AXIS drawAxis, float fLineLen, bool bDrawLocalAxis)
    {
        Vector3 vecDirect = Vector3.zero;
        Vector3 vecPos    = Vector3.zero;
        Color   color     = Color.white;

        if (Camera.main == null)
        {
            return;
        }

        // set color
        switch (drawAxis)
        {
        case AXIS.X: color = Color.red;                 break;

        case AXIS.Y: color = Color.green;               break;

        case AXIS.Z: color = Color.blue;                break;
        }

        // draw line
        float     fDist     = FXMakerMain.inst.GetFXMakerMouse().m_fDistance;
        Rect      baseRect  = FXMakerLayout.GetEffectHierarchyRect();
        Vector3   guiCenPos = new Vector3(Screen.width / 2, Screen.height / 2, fDist);
        Vector3   guiPos    = new Vector3(baseRect.x - 50, baseRect.y + 30) - guiCenPos;
        Transform tempTrans = GetTempTransform();

        tempTrans.position = Camera.main.ScreenToWorldPoint(guiCenPos);
        vecDirect          = tempTrans.position + GetDirect(tempTrans, drawAxis, true) * fDist / 20;
        vecPos             = Camera.main.WorldToScreenPoint(vecDirect);
        vecPos.y           = Screen.height - vecPos.y;
        NgGUIDraw.DrawLine(guiPos + guiCenPos, guiPos + vecPos, color, 3, true);
    }