Esempio n. 1
0
    public override void setState(manipState state)
    {
        if (curState == manipState.grabbed && state != curState)
        {
            if (!isToggle)
            {
                keyHit(false);
            }
            if (!glowMatOnToggle)
            {
                rend.material = offMat;
            }
        }
        curState = state;
        if (curState == manipState.none)
        {
            if (!singleID)
            {
                _componentInterface.onSelect(false, button2DID[0], button2DID[1]);
            }
            selectOverlay.SetActive(false);
        }
        else if (curState == manipState.selected)
        {
            if (!singleID)
            {
                _componentInterface.onSelect(true, button2DID[0], button2DID[1]);
            }
            selectOverlay.SetActive(true);
        }
        else if (curState == manipState.grabbed)
        {
            if (!singleID)
            {
                _componentInterface.onSelect(true, button2DID[0], button2DID[1]);
            }
            if (isToggle)
            {
                toggled = !toggled;
                if (toggled)
                {
                    keyHit(true);
                }
                else if (!onlyOn)
                {
                    keyHit(false);
                }
            }
            else
            {
                keyHit(true);
            }

            if (!glowMatOnToggle)
            {
                rend.material = glowMat;
            }
        }
    }
Esempio n. 2
0
    public override void setState(manipState state)
    {
        if (curState == manipState.grabbed)
        {
            if (_interface != null)
            {
                _interface.onGrab(false, 0);
            }
        }
        curState = state;
        if (curState == manipState.none)
        {
            if (_interface != null)
            {
                _interface.onSelect(false, ID);
            }
            if (usingGlowMat)
            {
                rend.material = offMat;
            }
            else
            {
                rend.material.SetColor("_TintColor", glowColor * 0.25f);
            }
        }
        else if (curState == manipState.selected)
        {
            if (_interface != null)
            {
                _interface.onSelect(true, ID);
            }
            if (usingGlowMat)
            {
                rend.material = glowMat;
                glowMat.SetColor("_TintColor", glowColor * .25f);
            }
            else
            {
                rend.material.SetColor("_TintColor", glowColor * 0.5f);
            }
        }
        else if (curState == manipState.grabbed)
        {
            if (_interface != null)
            {
                _interface.onSelect(true, ID);
            }
            if (usingGlowMat)
            {
                rend.material = glowMat;
            }
            else
            {
                rend.material.SetColor("_TintColor", glowColor * 0.5f);
            }

            posstart = (Vector2)transform.localPosition;
            offset.x = transform.localPosition.x - transform.parent.InverseTransformPoint(manipulatorObj.position).x;
            offset.y = transform.localPosition.y - transform.parent.InverseTransformPoint(manipulatorObj.position).y;

            if (_interface != null)
            {
                _interface.onGrab(true, 0);
            }
        }
    }