Пример #1
0
    //
    // Draw handler for Rotate mode
    //
    void DrawRotHandler(Color c, Vector2 pos0, float angle, float length)
    {
        Handles.color = c;

        Vector2 pos1 = new Vector2(m_Pos.x + Mathf.Cos(angle) * length, m_Pos.y + Mathf.Sin(angle) * length);

        GUIEditorUtils.DrawClippedLine(pos0, pos1);
    }
Пример #2
0
    //
    // Draw handler for Scale mode
    //
    void DrawScaleHandler(Color c, Vector2 pos0, float angle, float length)
    {
        Handles.color = c;

        Vector2 pos1 = new Vector2(m_Pos.x + Mathf.Cos(angle) * length, m_Pos.y + Mathf.Sin(angle) * length);

        GUIEditorUtils.DrawClippedLine(pos0, pos1);

        DrawPoint(c, pos1, DEFAULT_SCALEHANDLER_RADIUS, m_Rot);
    }
Пример #3
0
    //
    // Draw Point
    //
    void DrawPoint(Color c, Vector2 pos, float radius, float angle)
    {
        Handles.color = c;

        Vector2 p0 = new Vector2(pos.x + (Mathf.Cos(angle + HALF_PI * 0.5f) * radius), pos.y + (Mathf.Sin(angle + HALF_PI * 0.5f) * radius));
        Vector2 p1 = new Vector2(pos.x + (Mathf.Cos(angle + HALF_PI * 1.5f) * radius), pos.y + (Mathf.Sin(angle + HALF_PI * 1.5f) * radius));
        Vector2 p2 = new Vector2(pos.x + (Mathf.Cos(angle + HALF_PI * 2.5f) * radius), pos.y + (Mathf.Sin(angle + HALF_PI * 2.5f) * radius));
        Vector2 p3 = new Vector2(pos.x + (Mathf.Cos(angle + HALF_PI * 3.5f) * radius), pos.y + (Mathf.Sin(angle + HALF_PI * 3.5f) * radius));

        GUIEditorUtils.DrawClippedLine(p0, p1);
        GUIEditorUtils.DrawClippedLine(p1, p2);
        GUIEditorUtils.DrawClippedLine(p2, p3);
        GUIEditorUtils.DrawClippedLine(p3, p0);
    }
Пример #4
0
    //
    // Draw Arrow
    //
    void DrawArrow(Color c, Vector2 pos0, float angle, float length)
    {
        Handles.color = c;

        Vector2 pos1 = new Vector2(pos0.x + Mathf.Cos(angle) * length, pos0.y + Mathf.Sin(angle) * length);

        GUIEditorUtils.DrawClippedLine(pos0, pos1);

        Vector2 tmpPos = new Vector2(pos1.x + Mathf.Cos(angle + DEFAULT_ARROWHEAD_ANGLE) * DEFAULT_ARROWHEAD_LENGTH, pos1.y + Mathf.Sin(angle + DEFAULT_ARROWHEAD_ANGLE) * DEFAULT_ARROWHEAD_LENGTH);

        GUIEditorUtils.DrawClippedLine(pos1, tmpPos);

        tmpPos = new Vector2(pos1.x + Mathf.Cos(angle - DEFAULT_ARROWHEAD_ANGLE) * DEFAULT_ARROWHEAD_LENGTH, pos1.y + Mathf.Sin(angle - DEFAULT_ARROWHEAD_ANGLE) * DEFAULT_ARROWHEAD_LENGTH);
        GUIEditorUtils.DrawClippedLine(pos1, tmpPos);
    }