Esempio n. 1
0
        /// <summary>
        /// Handles editor input.
        /// </summary>
        public void Input(SceneView view)
        {
            Event e = Event.current;

            if (e.isKey)
            {
                if (e.type == EventType.KeyDown)
                {
                    if (e.keyCode == settings.APPLY_SINGLE)
                    {
                        if (state == SelectState.Two)
                        {
                            state = SelectState.None;
                            GetSelectionOfObjects();
                        }
                    }
                }
            }

            if (e.type == EventType.MouseDown)
            {
                Vector3 tar = VMEGlobal.GetPositionNextToHoveredTile();

                if (e.button == 0)
                {
                    if (tar == new Vector3(0, 9000, 0))
                    {
                        firstTarget.transform.position  = new Vector3(0, 9000, 0);
                        secondTarget.transform.position = new Vector3(0, 9000, 0);
                        state = SelectState.None;
                    }
                    else
                    {
                        if (state == SelectState.None)
                        {
                            firstTarget.transform.position = tar;
                            state = SelectState.One;
                        }
                        else if (state == SelectState.One)
                        {
                            secondTarget.transform.position = tar;
                            state = SelectState.Two;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void PaintAtHoverPosition()
        {
            //Get GameObject that we hovered over to check if we can paint,
            //also use its rotation for the new tile.
            GameObject hoveredTile = VMEGlobal.GetTileAtMousePosition();

            //if theres none.
            if (hoveredTile == null)
            {
                Debug.LogWarning("[Paint Mode]: Not hovered over a tile, thereby can't paint a tile.");
            }
            else
            {
                //Get selected item in Swatch.
                GameObject selectedSwatchItem = voxelSwatchReference.GetSelectedTile();

                //Get position next to hovered tile.
                Vector3 newPosition = VMEGlobal.GetPositionNextToHoveredTile();

                //Paint the tile.
                VMEMainWindow.Instance.tileAddControls.PaintTIle(selectedSwatchItem, hoveredTile, newPosition);
            }
        }