Esempio n. 1
0
    public override void handUpdate(GameObject handOb, bool pinch, bool startButton, Vector2 delta, bool touchedPad)
    {
        if (startButton)
        {
            if (propMenu != null)
            {
                GameObject.Destroy(propMenu);
            }
            else
            {
                openPropMenu();
            }
        }
        if (propObject == null)
        {
            setPropObject(PropHandler.props[PropHandler.nameList[currentProp]]);
        }

        sel.select(handOb);
        Color color = Color.red;

        if (touchedPad)
        {
            if (usepresnapped)
            {
                propObject.transform.rotation = presnapped;
            }
            rotate(propObject.transform, delta);
            presnapped    = propObject.transform.rotation;
            usepresnapped = true;
        }

        if (sel.hitObject())
        {
            color = Color.green;
            if (snapCool == 0)
            {
                propObject.transform.position = sel.getEnd();
                if (PropHandler.snap(propObject))
                {
                    snapCool = 4;
                }
            }
            else
            {
                snapCool--;
            }
            if (pinch)
            {
                SetAllCollision(propObject, true);
                PropHandler.track(propObject);
                Prop prop = propObject.GetComponent <Prop>();
                RedoManager.addRedoObject(new UncreateObject(prop.propObjectId));
                propObject = null;
            }
        }
        sel.drawLine(color);
    }
Esempio n. 2
0
    public override void handUpdate(GameObject handOb, bool pinch)
    {
        sel.select(handOb);
        Color color = Color.gray;

        if (sel.getSelected() != null)
        {
            color = Color.red;
            if (pinch)
            {
                UnmoveObject unmoveObject = new UnmoveObject(sel.getSelected().propObjectId, sel.getSelected().gameObject.transform, sel.getSelected().name, sel.getSelected().paintHistory);
                RedoManager.addRedoObject(unmoveObject);
                PropHandler.untrack(sel.getSelected().gameObject, true);
            }
        }
        sel.drawLine(color);
    }
Esempio n. 3
0
    public UnpaintObject paintObject(GameObject objectToPaint, Color color, bool addToHistory, bool addToUndo)
    {
        Renderer rend = objectToPaint.GetComponent <Renderer>();

        if (rend == null)
        {
            return(null);
        }
        List <int>    path = getPathTo(gameObject, objectToPaint);
        UnpaintObject upo  = new UnpaintObject(propObjectId, rend.material.color, color, path);

        if (addToHistory)
        {
            paintHistory.Add(upo);
        }
        if (addToUndo)
        {
            RedoManager.addRedoObject(upo);
        }
        rend.material.color = color;
        return(upo);
    }
Esempio n. 4
0
    public void addUndo()
    {
        Prop prop = propObject.GetComponent <Prop>();

        RedoManager.addRedoObject(new UnmoveObject(prop.propObjectId, initPosition, initRotation, initLocalScale, prop.name));
    }