コード例 #1
0
        public bool showAdditionalSettings = true; //TODO: Maybe we can remove if we decide always show additional settings

#if UNITY_EDITOR
        private void DrawGizmos(bool selected)
        {
            var light      = gameObject.GetComponent <Light>();
            var gizmoColor = light.color;

            gizmoColor.a = selected ? 1.0f : 0.3f;
            Gizmos.color = Handles.color = gizmoColor;

            if (lightTypeExtent == LightTypeExtent.Punctual)
            {
                switch (light.type)
                {
                case LightType.Directional:
                    ClusterLightEditorUtilities.DrawDirectionalLightGizmo(light);
                    if (gameObject.GetComponent <CachedShadowData>().UseStaticShadowmapForLastCascade)
                    {
                        ClusterLightEditorUtilities.DrawDirectionalStaticShadowBoxGizmo(light, true);
                    }
                    break;

                case LightType.Point:
                    ClusterLightEditorUtilities.DrawPointlightGizmo(light, selected);
                    break;

                case LightType.Spot:
                    if (spotLightShape == SpotLightShape.Cone)
                    {
                        ClusterLightEditorUtilities.DrawSpotlightGizmo(light, selected);
                    }
                    else if (spotLightShape == SpotLightShape.Pyramid)
                    {
                        ClusterLightEditorUtilities.DrawFrustumlightGizmo(light);
                    }
                    else if (spotLightShape == SpotLightShape.Box)
                    {
                        ClusterLightEditorUtilities.DrawFrustumlightGizmo(light);
                    }
                    break;
                }
            }
            else
            {
                switch (lightTypeExtent)
                {
                case LightTypeExtent.Rectangle:
                    ClusterLightEditorUtilities.DrawArealightGizmo(light);
                    break;

                case LightTypeExtent.Line:
                    ClusterLightEditorUtilities.DrawArealightGizmo(light);
                    break;
                }
            }

            if (selected)
            {
                DrawVerticalRay();
            }
        }