コード例 #1
0
    private static void SceneGUISpeedBased()
    {
        DisplayAtPoint();

        CameraPathSpeedList pointList = _cameraPath.speedList;
        Camera sceneCamera            = Camera.current;
        int    pointCount             = pointList.realNumberOfPoints;

        for (int i = 0; i < pointCount; i++)
        {
            CameraPathSpeed point = pointList[i];
            if (_cameraPath.enableUndo)
            {
                Undo.RecordObject(point, "Modifying Speed Point");
            }
            if (Vector3.Dot(sceneCamera.transform.forward, point.worldPosition - sceneCamera.transform.position) < 0)
            {
                continue;
            }

            string pointLabel = point.displayName;
            pointLabel += "\nvalue: " + point.speed + " m/s";
            pointLabel += "\npercent: " + point.percent;
            pointLabel += "\na percent: " + _cameraPath.DeNormalisePercentage(point.percent);

            Handles.Label(point.worldPosition, pointLabel);
            float pointHandleSize = HandleUtility.GetHandleSize(point.worldPosition) * HANDLE_SCALE;
            Handles.color = (i == selectedPointIndex) ? _cameraPath.selectedPointColour : _cameraPath.unselectedPointColour;
            if (Handles.Button(point.worldPosition, Quaternion.identity, pointHandleSize, pointHandleSize, Handles.DotCap))
            {
                ChangeSelectedPointIndex(i);
                GUI.changed = true;
            }

            if (i == selectedPointIndex)
            {
                CPPSlider(point);
            }
        }
    }