예제 #1
0
 private void StopBuilding()
 {
     this.m_currentBuildingToPlace = null;
     this.m_currentState           = MouseState.NORMAL;
     Destroy(this.m_previewBuilding.gameObject);
     this.m_previewBuilding = null;
     this.m_currentRotation = 0f;
 }
예제 #2
0
        private void CreatePreview()
        {
            var pos = Vector3.negativeInfinity;
            var ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());

            if (Physics.Raycast(ray, out var hit, Mathf.Infinity, this.m_constructionLayers))
            {
                pos = this.GetGridPos(hit.point);
            }

            this.m_previewBuilding         = Instantiate(this.m_currentBuildingToPlace.ToPlace, pos, Quaternion.identity).GetComponent <PreviewBuilding>();
            this.m_previewBuilding.enabled = true;
            this.m_previewBuilding.name   += "(Preview)";
        }