Example #1
0
        /// <summary>
        ///     Handles numeric key presses.
        /// </summary>
        /// <param name="key">1-4</param>
        private void HandleNumberKey(int key)
        {
            if (_rotControl == null)
            {
                activePanel.Controls.Clear();
                Size = new Size(_rotationSize);

                switch (key)
                {
                case 1:
                    _rotControl = new RotationControl(this, RotationData.Rotation1, _localRotIndex);
                    break;

                case 2:
                    _rotControl = new RotationControl(this, RotationData.Rotation2, _localRotIndex);
                    break;

                case 3:
                    _rotControl = new RotationControl(this, RotationData.Rotation3, _localRotIndex);
                    break;

                case 4:
                    _rotControl = new RotationControl(this, RotationData.Rotation4, _localRotIndex);
                    break;

                default:
                    MessageBox.Show("Out of range handlenumberkey " + key);
                    throw new ArgumentOutOfRangeException(key.ToString());
                }
                activePanel.Controls.Add(_rotControl);
            }
        }
Example #2
0
        /// <summary>
        ///     Resets the rotations and shows selection.
        /// </summary>
        public void Reset()
        {
            activePanel.Controls.Clear();
            activePanel.Controls.Add(_selectionControl);
            _rotControl = null;

            _localRotIndex = 0;

            UpdateVisualValues(_localRotIndex);

            Size = new Size(_selectionSize);
        }
Example #3
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;
        }
    }
Example #4
0
    /**
     * 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;
        }
    }
Example #5
0
 void Awake()
 {
     instance = this;
 }