Exemplo n.º 1
0
    void Update()
    {
        foreach (KeyValuePair <manipulator, GameObject> entry in activePreviews)
        {
            if (entry.Key.isGrabbing() || multiselectTransform != null)
            {
                entry.Value.SetActive(false);
                entry.Key.toggleMultiselect(false, this);
            }
            else if (entry.Key.emptyGrab)
            {
                spawnEvent(entry.Key, _interface.worldPosToGridPos(entry.Key.transform.position));
                killMultiselect();
            }
            else
            {
                entry.Value.SetActive(true);
                entry.Key.toggleMultiselect(true, this);
                entry.Value.transform.position = _interface.transform.TransformPoint(_interface.worldPosToGridPos(entry.Key.transform.position, true));
            }
        }

        if (multiselectTransform != null) //multiselecting
        {
            updateMultiselect();
        }
    }
Exemplo n.º 2
0
    void recalcRange()
    {
        cornerA = _interface.worldPosToGridPos(transform.TransformPoint(-.5f, -.5f, 0));
        cornerB = _interface.worldPosToGridPos(transform.TransformPoint(.5f, .5f, 0));


        xRange = new Vector2(_interface._gridParams.XtoUnit(cornerA.x), _interface._gridParams.XtoUnit(cornerB.x));
        yRange = new Vector2(_interface._gridParams.YtoUnit(cornerA.y), _interface._gridParams.YtoUnit(cornerB.y));

        if (xRange.x > xRange.y)
        {
            xRange = new Vector2(xRange.y, xRange.x);
        }
        if (yRange.x > yRange.y)
        {
            yRange = new Vector2(yRange.y, yRange.x);
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        if (pleaseDestroy)
        {
            Destroy(gameObject);
        }

        if (recordingUpdate)
        {
            recordingUpdate = false;
            toggleEdges(!recording);
        }

        if (edgeInHandle.curState == manipObject.manipState.grabbed || edgeOutHandle.curState == manipObject.manipState.grabbed)
        {
            edgeIn.localPosition  = edgeInHandle.transform.localPosition;
            edgeOut.localPosition = edgeOutHandle.transform.localPosition;

            edgeIn.position  = _componentInterface.transform.TransformPoint(_componentInterface.worldPosToGridPos(edgeIn.position));
            edgeOut.position = _componentInterface.transform.TransformPoint(_componentInterface.worldPosToGridPos(edgeOut.position));

            gridUpdateDesired = true;
            recalcTrackPosition();
            overlapCheck();
        }
        else if (gridUpdateDesired)
        {
            gridUpdateDesired = false;
            gridUpdate();
            rangeCheck();
        }

        bool edgeCheck = in_out.y - in_out.x >= .2f || edgeInHandle.curState == manipObject.manipState.grabbed || edgeOutHandle.curState == manipObject.manipState.grabbed;

        toggleEdges(edgeCheck);
    }