Exemplo n.º 1
0
        public void SetTarget()
        {
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("[Target Select Helper]", EditorStyles.boldLabel);
            lookupObject = EditorGUILayout.ObjectField(lookupObject, typeof(GameObject), allowSceneObjects: true) as GameObject;
            if (lookupObject != null && PrefabHelper.IsPrefab(lookupObject))
            {
                lookupObject = null;
                Debug.Log("Prefab is not allowed. Please select only the GameObject in the scene.");
            }
            if (lookupObject)
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    bIncludeChild = EditorGUILayout.ToggleLeft("Include Child", bIncludeChild);
                    if (GUILayout.Button("Add"))
                    {
                        light.AddTarget(lookupObject, bIncludeChild);
                    }
                    if (GUILayout.Button("Remove"))
                    {
                        light.RemoveTarget(lookupObject, bIncludeChild);
                    }
                }
            }
            EditorGUILayout.Separator();
            layerMask = CustomEditorGUI.LayerMaskField("Layer Mask for Add/Remove", layerMask);
            GUILayoutOption halfWidth = GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.5f);

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUI.DisabledGroupScope(layerMask == 0))
                {
                    if (GUILayout.Button("Add all Masked Iso2DBase", halfWidth))
                    {
                        light.AddTarget_All(layerMask);
                    }
                    if (GUILayout.Button("Clear all Masked layer", halfWidth))
                    {
                        light.RemoveTarget_All(layerMask);
                    }
                }
            }
            EditorGUILayout.Separator();
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("Add all Iso2DBase", halfWidth))
                {
                    light.AddTarget_All(layerMask);
                }
                if (GUILayout.Button("Clear TargetList", halfWidth))
                {
                    light.RemoveTarget_All();
                }
            }
        }