public void LoadSave(PillarDimensionObjectOld dimensionObj)
        {
            dimensionObj.treatChildrenAsOneObjectRecursively = this.treatChildrenAsOneObjectRecursively;
            dimensionObj.channel                   = this.channel;
            dimensionObj.baseDimension             = this.baseDimension;
            dimensionObj.reverseVisibilityStates   = this.reverseVisibilityStates;
            dimensionObj.ignoreMaterialChanges     = this.ignoreMaterialChanges;
            dimensionObj.curDimensionSetInMaterial = this.curDimensionSetInMaterial;
            dimensionObj.startingVisibilityState   = (VisibilityState)this.visibilityState;
            dimensionObj.visibilityState           = (VisibilityState)this.visibilityState;

            dimensionObj.continuouslyUpdateOnOffAngles = this.continuouslyUpdateOnOffAngles;
            dimensionObj.objectStartDimension          = this.objectStartDimension;
            dimensionObj.objectEndDimension            = this.objectEndDimension;
            dimensionObj.findPillarsTechnique          = (FindPillarsTechnique)this.findPillarsTechnique;
            dimensionObj.whitelist           = this.whitelist.Select(p => p.Reference).ToList();
            dimensionObj.blacklist           = this.blacklist.Select(p => p.Reference).ToList();
            dimensionObj.pillarSearchRadius  = this.pillarSearchRadius;
            dimensionObj.pillarSearchBoxSize = this.pillarSearchBoxSize;
            dimensionObj.overrideOnOffAngles = this.overrideOnOffAngles;
            dimensionObj.onAngle             = this.onAngle;
            dimensionObj.offAngle            = this.offAngle;
            dimensionObj.centralAngle        = this.centralAngle;

            if (dimensionObj.gameObject.activeInHierarchy)
            {
                dimensionObj.SwitchVisibilityState(dimensionObj.visibilityState, true);
            }
        }
 private void UpdateSearchBoxSizeForAll(PillarDimensionObjectOld script)
 {
     EditorGUI.BeginChangeCheck();
     script.pillarSearchBoxSize = EditorGUILayout.Vector3Field("Search box size: ", script.pillarSearchBoxSize);
     if (EditorGUI.EndChangeCheck())
     {
         foreach (Object obj in targets)
         {
             ((PillarDimensionObjectOld)obj).pillarSearchBoxSize = script.pillarSearchBoxSize;
         }
     }
 }
 private void UpdateSearchRadiusForAll(PillarDimensionObjectOld script)
 {
     EditorGUI.BeginChangeCheck();
     script.pillarSearchRadius = EditorGUILayout.FloatField("Search radius: ", script.pillarSearchRadius);
     if (EditorGUI.EndChangeCheck())
     {
         foreach (Object obj in targets)
         {
             ((PillarDimensionObjectOld)obj).pillarSearchRadius = script.pillarSearchRadius;
         }
     }
 }
 public PillarDimensionObjectSave(PillarDimensionObjectOld dimensionObj)
 {
     this.treatChildrenAsOneObjectRecursively = dimensionObj.treatChildrenAsOneObjectRecursively;
     this.channel                       = dimensionObj.channel;
     this.baseDimension                 = dimensionObj.baseDimension;
     this.reverseVisibilityStates       = dimensionObj.reverseVisibilityStates;
     this.ignoreMaterialChanges         = dimensionObj.ignoreMaterialChanges;
     this.curDimensionSetInMaterial     = dimensionObj.curDimensionSetInMaterial;
     this.visibilityState               = (int)dimensionObj.visibilityState;
     this.continuouslyUpdateOnOffAngles = dimensionObj.continuouslyUpdateOnOffAngles;
     this.objectStartDimension          = dimensionObj.objectStartDimension;
     this.objectEndDimension            = dimensionObj.objectEndDimension;
     this.findPillarsTechnique          = (int)dimensionObj.findPillarsTechnique;
     this.whitelist                     = dimensionObj.whitelist.Select <DimensionPillar, SerializableReference <DimensionPillar> >(p => p).ToList();
     this.blacklist                     = dimensionObj.blacklist.Select <DimensionPillar, SerializableReference <DimensionPillar> >(p => p).ToList();
     this.pillarSearchRadius            = dimensionObj.pillarSearchRadius;
     this.pillarSearchBoxSize           = dimensionObj.pillarSearchBoxSize;
     this.overrideOnOffAngles           = dimensionObj.overrideOnOffAngles;
     this.onAngle                       = dimensionObj.onAngle;
     this.offAngle                      = dimensionObj.offAngle;
     this.centralAngle                  = dimensionObj.centralAngle;
 }
    public override void OnInspectorGUI()
    {
        PillarDimensionObjectOld script = target as PillarDimensionObjectOld;
        float defaultWidth = EditorGUIUtility.labelWidth;

        serializedObject.Update();

        DEBUG.boolValue = EditorGUILayout.Toggle("Debug?", DEBUG.boolValue);

        AddSeparator();

        EditorGUI.BeginChangeCheck();
        script.startingVisibilityState = (VisibilityState)EditorGUILayout.EnumPopup("Starting visibility state: ", script.startingVisibilityState);
        if (EditorGUI.EndChangeCheck())
        {
            foreach (Object obj in targets)
            {
                ((PillarDimensionObjectOld)obj).startingVisibilityState = script.startingVisibilityState;
                if (!Application.isPlaying)
                {
                    ((PillarDimensionObjectOld)obj).visibilityState = script.startingVisibilityState;
                }
            }
        }
        EditorGUILayout.LabelField("Visibility State:", visibilityState.enumDisplayNames[visibilityState.intValue]);

        AddSeparator();

        GUILayout.Label("Config:", EditorStyles.miniBoldLabel);

        EditorGUI.BeginChangeCheck();
        script.findPillarsTechnique = (PillarDimensionObjectOld.FindPillarsTechnique)EditorGUILayout.EnumPopup("Find pillars by: ", script.findPillarsTechnique);
        if (EditorGUI.EndChangeCheck())
        {
            foreach (Object obj in targets)
            {
                ((PillarDimensionObjectOld)obj).findPillarsTechnique = script.findPillarsTechnique;
            }
        }

        EditorGUILayout.Space();
        switch (script.findPillarsTechnique)
        {
        case PillarDimensionObjectOld.FindPillarsTechnique.whitelist:
            SerializedProperty whitelist = serializedObject.FindProperty("whitelist");
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(whitelist, new GUIContent("Whitelist: "), true);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
            break;

        case PillarDimensionObjectOld.FindPillarsTechnique.automaticSphere:
            UpdateSearchRadiusForAll(script);
            break;

        case PillarDimensionObjectOld.FindPillarsTechnique.automaticSphereWithBlacklist: {
            UpdateSearchRadiusForAll(script);
            SerializedProperty blacklist = serializedObject.FindProperty("blacklist");
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(blacklist, new GUIContent("Blacklist: "), true);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
        break;

        case PillarDimensionObjectOld.FindPillarsTechnique.automaticBox:
            UpdateSearchBoxSizeForAll(script);
            break;

        case PillarDimensionObjectOld.FindPillarsTechnique.automaticBoxWithBlacklist: {
            UpdateSearchBoxSizeForAll(script);
            SerializedProperty blacklist = serializedObject.FindProperty("blacklist");
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(blacklist, new GUIContent("Blacklist: "), true);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
        break;

        case PillarDimensionObjectOld.FindPillarsTechnique.anyPillar:
            GUILayout.Label("This object will interact with any active pillar", EditorStyles.miniBoldLabel);
            break;
        }

        EditorGUILayout.Space();

        baseDimension.intValue = EditorGUILayout.IntSlider("Dimension:", baseDimension.intValue, 0, 123);
        EditorGUILayout.Space();
        EditorGUIUtility.labelWidth                   = 200;
        reverseVisibilityStates.boolValue             = EditorGUILayout.Toggle("Reverse visibility states?", reverseVisibilityStates.boolValue);
        ignoreMaterialChanges.boolValue               = EditorGUILayout.Toggle("Ignore material changes?", ignoreMaterialChanges.boolValue);
        treatChildrenAsOneObjectRecursively.boolValue = EditorGUILayout.Toggle("Treat children as one object?", treatChildrenAsOneObjectRecursively.boolValue);
        continuouslyUpdateOnOffAngles.boolValue       = EditorGUILayout.Toggle("Continuously Update OnOff Angles?", continuouslyUpdateOnOffAngles.boolValue);

        EditorGUIUtility.labelWidth = defaultWidth;

        AddSeparator();

        GUILayout.Label("On/Off Angles:", EditorStyles.miniBoldLabel);
        EditorGUIUtility.labelWidth   = 150;
        overrideOnOffAngles.boolValue = EditorGUILayout.Toggle("Override On/Off Angles?", overrideOnOffAngles.boolValue);
        EditorGUIUtility.labelWidth   = defaultWidth;

        if (overrideOnOffAngles.boolValue)
        {
            EditorGUI.BeginChangeCheck();
            script.onAngle  = Angle.Degrees(EditorGUILayout.FloatField("On Angle Degrees: ", script.onAngle.degrees));
            script.offAngle = Angle.Degrees(EditorGUILayout.FloatField("Off Angle Degrees: ", script.offAngle.degrees));
            if (EditorGUI.EndChangeCheck())
            {
                foreach (Object obj in targets)
                {
                    ((PillarDimensionObjectOld)obj).onAngle  = Angle.Degrees(EditorGUILayout.FloatField("On Angle Degrees: ", script.onAngle.degrees));
                    ((PillarDimensionObjectOld)obj).offAngle = Angle.Degrees(EditorGUILayout.FloatField("Off Angle Degrees: ", script.offAngle.degrees));
                }
            }
        }
        else
        {
            EditorGUILayout.LabelField("On Angle: ", script.onAngle.ToString());
            EditorGUILayout.LabelField("Off Angle: ", script.offAngle.ToString());
        }

        serializedObject.ApplyModifiedProperties();
    }