예제 #1
0
        public void Update()
        {
            if (!_buildMode)
            {
                return;
            }

            _buildingPlacer.Preview();
            _canvas.gameObject.SetActive(false);

            if (Input.GetMouseButtonDown(0))
            {
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    UnsetBuildingMode();
                }
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                _buildingPlacer.Rotate();
            }

            if (Input.mouseScrollDelta.y > 0)
            {
                _buildingPlacer.Rotate();
            }

            if (Input.mouseScrollDelta.y < 0)
            {
                _buildingPlacer.Rotate(true);
            }

            if (Input.GetMouseButtonDown(1))
            {
                UnsetBuildingMode();
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                UnsetBuildingMode();
            }
        }