Example #1
0
    /// <summary>
    /// Allow being deselected by returning false.
    /// </summary>
    public override bool OnDeselect(Selectable newSelection)
    {
        if (newSelection == null && secondDeselect)
        {                              // If clicked on empty space
            scaleCtrl.SetTarget(null); // Remove the position controller and Hide it
            return(false);
        }

        base.OnDeselect(newSelection);
        secondDeselect = true;
        return(true);        // Keep as clicked so on next click, deselect will be called again.
    }
Example #2
0
    public void SetTRSMode(TheWorld.AxisModes mode)
    {
        if (mode != TheWorld.axisMode)
        {
            // Save the old target
            GameObject target = null;
            switch (TheWorld.axisMode)
            {
            case TheWorld.AxisModes.TRANSLATING:
                target = tCtrl.target;
                tCtrl.SetTarget(null);
                btnT.interactable = true;
                break;

            case TheWorld.AxisModes.SCALING:
                target = sCtrl.target;
                sCtrl.SetTarget(null);
                btnS.interactable = true;
                break;
            }

            // Reselet what was being selected using the new axis mode
            switch (mode)
            {
            case TheWorld.AxisModes.TRANSLATING:
                tCtrl.SetTarget(target);
                btnT.interactable = false;
                break;

            case TheWorld.AxisModes.SCALING:
                sCtrl.SetTarget(target);
                btnS.interactable = false;
                break;
            }

            TheWorld.axisMode = mode;
        }
    }