Esempio n. 1
0
        public void OnSceneGUI()
        {
            LocalLight t = (target as LocalLight);

            if (!t.enabled)
            {
                return;
            }

            if (!multiTarget.Contains(t))
            {
                multiTarget.Add(t);
            }

            EditorGUI.BeginChangeCheck();
            Quaternion currentRot = t.totalRotationVector;
            Quaternion newRot     = Handles.RotationHandle(currentRot, t.transform.position);
            Vector3    tPos       = t.transform.position;

            var hColor = Handles.color;

            Handles.color = t.localLightColor;
            Handles.ArrowHandleCap(1, tPos, newRot, 1, EventType.Repaint);
            Handles.color = hColor;

            if (EditorGUI.EndChangeCheck())
            {
                foreach (var mt in multiTarget)
                {
                    Undo.RecordObject(mt, "Rotated totalRotationVector");
                    mt.totalRotationVector = newRot;
                    mt.Update();
                }
            }
        }
Esempio n. 2
0
        void ExcludeFromParent(Transform t, List <Renderer> renderers)
        {
            Transform  parentT         = t.parent;
            LocalLight parentComponent = null;

            while (parentT != null)
            {
                parentComponent = parentT.GetComponent <LocalLight>();
                if (parentComponent != null)
                {
                    parentComponent.ExcludeRenderers(renderers);
                }
                parentT = parentT.parent;
            }
        }
Esempio n. 3
0
        void TransferToParent(Transform t, List <Renderer> renderers)
        {
            Transform  parentT         = t.parent;
            LocalLight parentComponent = null;

            while (parentT != null && parentComponent == null)
            {
                parentComponent = parentT.GetComponent <LocalLight>();
                parentComponent = parentComponent != null && parentComponent.enabled ? parentComponent : null;
                parentT         = parentT.parent;
            }
            if (parentComponent != null && parentComponent.IncludeRenderers(renderers))
            {
                ;
            }
            else
            {
                UseGlobalLight(renderers);
            }
        }