예제 #1
0
 private void OnSceneGUI()
 {
     if (Tools.current == Tool.Move)
     {
         Tools.hidden = true;
         ZAxisHandle();
         XAxisHandle();
         YAxisHandle();
         if (_instance != null && IsoSnapping.DoSnap)
         {
             _instance.Position = IsoSnapping.Ceil(_instance.Position);
         }
     }
     else
     {
         Tools.hidden = false;
     }
 }
예제 #2
0
    void OnSceneGUI()
    {
        //calc the custom handle position in sceneview
        var isoHandlePos = Isometric.isoProjection(center);
        var t            = (IsoObject)target;


        if (GUI.changed)
        {
            centerNeedsUpdate = true;
        }
        var x = 0f;
        var y = 0f;
        var z = 0f;

        //Get deltas for (north, up, west)
        try {
            x = handleX(isoHandlePos);
            y = handleY(isoHandlePos);
            z = handleZ(isoHandlePos);
        } catch (ArithmeticException) {
        }


        //snaps the target to closest multiple
        if (IsoSnapping.doSnap)
        {
            Vector3 vec = IsoSnapping.Ceil(new Vector3(x, y, z));
            x = vec.x;
            y = vec.y;
            z = vec.z;
        }

        if (Event.current.shift)
        {
            x *= 0.1f;
            y *= 0.1f;
            z *= 0.1f;
        }

        if (t.displayBounds)
        {
            DrawWireCube(t.Position, t.Size);
        }

        switch (GUI.GetNameOfFocusedControl())
        {
        case "x":
            delta = new Vector3(x, 0, 0);
            break;

        case "y":
            delta = new Vector3(0, y, 0);
            break;

        case "z":
            delta = new Vector3(0, 0, z);
            break;

        default:
            break;
        }
        t.Position += delta;

        EditorUtility.SetDirty(t);
    }