示例#1
0
        protected override void DrawSceneGizmos(IGridManager gridManager, Painter.InputState inputState, Rect rect, Matrix4x4 TRS)
        {
            var gridSize = gridManager.GetGridSize();

            Handles.color = Color.white * 0.5f;
            Handles.CircleHandleCap(-1, inputState.PlanePosition, Quaternion.LookRotation(Vector3.up), gridSize * Radius, EventType.Repaint);
            var scaledRad = gridSize * Radius;

            for (var i = -scaledRad; i <= scaledRad; i += gridSize)
            {
                for (var j = -scaledRad; j <= scaledRad; j += gridSize)
                {
                    var pos        = inputState.GridPosition + new Vector3(i, 0, j);
                    var circleDist = Vector2.Distance(inputState.GridPosition.xz(), pos.xz());
                    if (circleDist > scaledRad)
                    {
                        continue;
                    }
                    Handles.RectangleHandleCap(-1, pos, Quaternion.LookRotation(Vector3.up), gridSize / 2, EventType.Repaint);
                }
            }
            Handles.color = Color.white;
            Handles.CircleHandleCap(-1, inputState.GridPosition, Quaternion.LookRotation(Vector3.up), gridSize * Radius, EventType.Repaint);
        }