コード例 #1
0
    /**
     * Apply the given tool to the given GameObject.
     */
    private void SetupToolOnObj(GameObject obj, Tool tool)
    {
        switch (tool)
        {
        case Tool.ADD:
        case Tool.REMOVE:
            toolObj = Instantiate(toolPrefab);
            break;

        case Tool.POSITION:
            if (selectedObj != null)
            {
                toolObj = Instantiate(toolPrefab, obj.transform.position, Quaternion.identity);
                PositionControl positionControl = toolObj.GetComponent <PositionControl>();
                positionControl.LinkObject(selectedObj);
            }
            break;

        case Tool.ROTATION:
            if (selectedObj != null)
            {
                toolObj = Instantiate(toolPrefab, obj.transform.position, obj.transform.rotation);
                RotationControl rotationControl = toolObj.GetComponent <RotationControl>();
                rotationControl.LinkObject(selectedObj);
            }
            break;

        case Tool.SCALE:
            if (selectedObj != null)
            {
                toolObj = Instantiate(toolPrefab, obj.transform.position, obj.transform.rotation);
                ScaleControl scaleControl = toolObj.GetComponent <ScaleControl>();
                scaleControl.LinkObject(selectedObj);
            }
            break;

        case Tool.TEXT:
            if (selectedObj != null)
            {
                labelPanel.SetActive(true);
            }
            break;
        }
    }
コード例 #2
0
ファイル: GizmoControl.cs プロジェクト: vedants/ScanNetPP
    /**
     * Apply the given tool to the given GameObject.
     */
    private void SetupToolOnObj(GameObject obj, Tool tool)
    {
        switch (tool)
        {
        case Tool.POSITION:
            toolObj = Instantiate(toolPrefab, obj.transform.position, Quaternion.identity);
            PositionControl positionControl = toolObj.GetComponent <PositionControl>();
            positionControl.LinkObject(selectedObj);
            break;

        case Tool.ROTATION:
            toolObj = Instantiate(toolPrefab, obj.transform.position, obj.transform.rotation);
            RotationControl rotationControl = toolObj.GetComponent <RotationControl>();
            rotationControl.LinkObject(selectedObj);
            break;

        case Tool.SCALE:
            toolObj = Instantiate(toolPrefab, obj.transform.position, obj.transform.rotation);
            ScaleControl scaleControl = toolObj.GetComponent <ScaleControl>();
            scaleControl.LinkObject(selectedObj);
            break;
        }
    }