Пример #1
0
    PPSpace GetSpaceFromArrow()
    {
        //This method allows clicking on the InfoArrow
        //and returns its respective space
        PPSpace    clicked  = null;
        Ray        ClickRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ClickRay, out hit))
        {
            if (hit.collider.gameObject.transform != null && hit.collider.gameObject.tag == "InfoArrow")
            {
                clicked = hit.collider.gameObject.GetComponent <InfoArrow>().GetSpace();
                //print($"Clicked on {clicked.Name}'s arrow");
                _showSpaceData        = true;
                _spaceData            = clicked.GetSpaceInfo();
                _cameraPivot.position = hit.collider.gameObject.transform.position;
                _selectedSpace        = clicked;
            }
        }
        else
        {
            _spaceData            = null;
            _selectedSpace        = null;
            _showSpaceData        = false;
            _cameraPivot.position = new Vector3(_gridSize.x / 2, 0, _gridSize.z / 2) * _voxelSize;
        }
        return(clicked);
    }
Пример #2
0
    void DebugWindow(int windowID)
    {
        GUIStyle style       = _skin.GetStyle("debugWindow");
        int      leftPad     = 10;
        int      topPad      = 10;
        int      fieldWidth  = 300 - (leftPad * 2);
        int      fieldHeight = 25;
        //int buttonWidth = 50;
        int windowSize = (fieldHeight * 25) + 10;

        int count = 1;

        _compiledMessage[0] = "Debug output";

        //Time Button
        if (GUI.Button(new Rect(leftPad, windowSize - ((fieldHeight + topPad) * count++), fieldWidth, fieldHeight), "Processing Durations"))
        {
            _showTime = !_showTime;
            if (_showTime)
            {
                _compiledMessage[1] = "Time: \n" + $"Parts: {_boundaryPartsTime}ms \n"
                                      + $"Graphs: {_boundaryGraphTime}ms \n"
                                      + $"Boudaries Total: {_boundaryMainTime}ms \n"
                                      + $"Single Space: {_singleSpaceTime}ms \n"
                                      + $"All Spaces: {_allSpacesTime}ms";
            }
            else
            {
                _compiledMessage[1] = "escape";
            }
        }

        //Show Raw Boundaries
        if (GUI.Button(new Rect(leftPad, windowSize - ((fieldHeight + topPad) * count++), fieldWidth, fieldHeight), "Raw Boundaries"))
        {
            _showRawBoundaries = !_showRawBoundaries;
        }

        //Show Spaces
        if (GUI.Button(new Rect(leftPad, windowSize - ((fieldHeight + topPad) * count++), fieldWidth, fieldHeight), "Spaces"))
        {
            _showSpaces = !_showSpaces;
            //Change the visibility of the spaces' InfoArrows
            foreach (var space in _spaces)
            {
                space.InfoArrowVisibility(_showSpaces);
            }
        }

        //Debug Message
        _debugMessage = "";
        if (_showSpaces && _showSpaceData)
        {
            _debugMessage = _selectedSpace.GetSpaceInfo();
        }
        else
        {
            for (int i = 0; i < _compiledMessage.Length; i++)
            {
                var line = _compiledMessage[i];
                if (line != "escape")
                {
                    _debugMessage += line + '\n';
                }
            }
        }
        GUI.Box(new Rect(leftPad, topPad, fieldWidth, fieldHeight), _debugMessage, "debugMessage");
    }