Example #1
0
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;
            serializedObject.Update();
            fader = (FadeObstructorsVolumetric)target;
            Commons.DrawTexture(ResourceHelper.LogoFadeObstructorsVolumetric);
            backColorOriginal  = GUI.backgroundColor;
            labelColorOriginal = GUI.contentColor;
            EditorGUILayout.Separator();
            Commons.SetColors(backColor, labelColor);

            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            bool tmpBool = EditorGUILayout.Toggle(new GUIContent("Ignore Triggers", "Do not take into account any trigger"), fader.ignoreTriggers);

            if (tmpBool != fader.ignoreTriggers)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Ignore triggers");
                fader.ignoreTriggers = tmpBool;
            }
            Commons.SetColors(backColorOriginal, labelColor);
            Color tmpColor = EditorGUILayout.ColorField(new GUIContent("Fade Color", "Color shade and alpha to use during the fading"), fader.fadingColorToUse);

            if (tmpColor != fader.fadingColorToUse)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Fading Color");
                fader.fadingColorToUse = tmpColor;
            }
            Commons.SetColors(backColor, labelColor);
            LayerMask tmpMask = Commons.LayerMaskField(new GUIContent("Layers to fade", "The layers we want to fade. IF YOU USE MULTIPLE INSTANCES OF THIS SCRIPT ON THE SASME CAMERA MAKE SURE THAT EACH INSTANCE MANAGES ONLY ITS OWN LAYERS!"), fader.layersToFade);

            if (tmpMask != fader.layersToFade)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Layers to fade");
                fader.layersToFade = tmpMask;
            }
            SerializedProperty playerT = serializedObject.FindProperty("playerTransform");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(playerT, new GUIContent("Player Transform", "The Transform of the Player"), true);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Player Transform");
                serializedObject.ApplyModifiedProperties();
            }
            float tmpFloat = EditorGUILayout.Slider(new GUIContent("Volume offset", "The distance off the target to avoid fading too much"), fader.offset, -2f, 0f);

            if (tmpFloat != fader.offset)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Volume offset");
                fader.offset = tmpFloat;
            }
            string tmpString = EditorGUILayout.TagField(new GUIContent("Player Tag", "Select the player's tag"), fader.playerTag);

            if (tmpString != fader.playerTag)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Player Tag");
                fader.playerTag = tmpString;
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();

            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            EditorGUILayout.Separator();
            tmpBool = EditorGUILayout.Toggle(new GUIContent("Common Volume", "Use the same volume for all instances of this script on this camera"), FadeObstructorsVolumetric.commonVolume);
            if (tmpBool != fader._commonVolume)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Common Volume");
                fader._commonVolume = tmpBool;
                FadeObstructorsVolumetric.commonVolume = tmpBool;
            }
            EditorGUILayout.Separator();
            if (FadeObstructorsVolumetric.commonVolume)
            {
                tmpFloat = EditorGUILayout.Slider(new GUIContent("Common radius", "The radius of the unique capsule used as volume casting for all the instances if Common Volume is active. This should be fairly small"), FadeObstructorsVolumetric.commonRadius, 0.01f, 1f);
                if (tmpFloat != fader._commonRadius)
                {
                    isDirty = true;
                    Undo.RecordObject(fader, "Raycast offset");
                    fader._commonRadius = tmpFloat;
                    FadeObstructorsVolumetric.commonRadius = tmpFloat;
                }
                EditorGUILayout.Separator();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();

            if (!FadeObstructorsVolumetric.commonVolume)
            {
                EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
                EditorGUILayout.Separator();
                tmpFloat = EditorGUILayout.Slider(new GUIContent("Volume radius", "The radius of the capsule used as volume casting. This should be fairly small"), fader.capsuleRadius, 0.01f, 1f);
                if (tmpFloat != fader.capsuleRadius)
                {
                    isDirty = true;
                    Undo.RecordObject(fader, "Raycast offset");
                    fader.capsuleRadius = tmpFloat;
                }
                EditorGUILayout.Separator();
                EditorGUILayout.EndVertical();
            }
            if (GUI.changed || isDirty)
            {
                EditorUtility.SetDirty(target); // or it won't save the data!!
            }
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;
            serializedObject.Update();
            fader = (FadeObstructors)target;
            Commons.DrawTexture(ResourceHelper.LogoFadeObstructors);
            backColorOriginal  = GUI.backgroundColor;
            labelColorOriginal = GUI.contentColor;
            EditorGUILayout.Separator();
            Commons.SetColors(backColor, labelColor);

            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            // Transparent Material
            Material tmpMat = EditorGUILayout.ObjectField(new GUIContent("Transparent material", "The transparent material to use for the fading"), fader.transparentMaterial, typeof(Material), false) as Material;

            if (tmpMat != fader.transparentMaterial)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Transparent material");
                fader.transparentMaterial = tmpMat;
            }
            // Replicate texture
            bool tmpBool = EditorGUILayout.Toggle(new GUIContent("Replicate texture", "Do we replicate the original texture on the transparent material?"), fader.replicateTexture);

            if (tmpBool != fader.replicateTexture)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Replicate texture");
                fader.replicateTexture = tmpBool;
            }
            // Fading time
            float tmpFloat = EditorGUILayout.Slider(new GUIContent("Fading out time", "The time for fading out the material"), fader.fadingTime, 0.05f, 2f);

            if (tmpFloat != fader.fadingTime)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Fading out time");
                fader.fadingTime = tmpFloat;
            }
            // Fading amount
            tmpFloat = EditorGUILayout.Slider(new GUIContent("Fading amount", "The fading amount"), fader.transparenceValue, 0f, 1f);
            if (tmpFloat != fader.transparenceValue)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Fading amount");
                fader.transparenceValue = tmpFloat;
            }
            tmpBool = EditorGUILayout.Toggle(new GUIContent("Ignore Triggers", "Do not take into account any trigger"), fader.ignoreTriggers);
            if (tmpBool != fader.ignoreTriggers)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Ignore triggers");
                fader.ignoreTriggers = tmpBool;
            }
            tmpBool = EditorGUILayout.Toggle(new GUIContent("Use SphereCast", "Cast a sphere instead of a ray"), fader.useSpherecast);
            if (tmpBool != fader.useSpherecast)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Use SphereCast");
                fader.useSpherecast = tmpBool;
            }
            if (fader.useSpherecast)
            {
                float tmpRadius = EditorGUILayout.FloatField(new GUIContent("Sphere radius", "The radius of the sphere to cast"), fader.spherecastRadius);
                if (tmpRadius != fader.spherecastRadius)
                {
                    isDirty = true;
                    Undo.RecordObject(fader, "Sphere radius");
                    fader.spherecastRadius = tmpRadius;
                }
            }
            Commons.SetColors(backColorOriginal, labelColor);
            Color tmpColor = EditorGUILayout.ColorField(new GUIContent("Fade Color", "Color shade and alpha to use during the fading"), fader.fadingColorToUse);

            if (tmpColor != fader.fadingColorToUse)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Fading Color");
                fader.fadingColorToUse = tmpColor;
            }
            Commons.SetColors(backColor, labelColor);
            LayerMask tmpMask = Commons.LayerMaskField(new GUIContent("Layers to fade", "The layers we want to fade. The layers we want to fade. IF YOU USE MULTIPLE INSTANCES OF THIS SCRIPT ON THE SASME CAMERA MAKE SURE THAT EACH INSTANCE MANAGES ONLY ITS OWN LAYERS!"), fader.layersToFade);

            if (tmpMask != fader.layersToFade)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Layers to fade");
                fader.layersToFade = tmpMask;
            }
            SerializedProperty playerT = serializedObject.FindProperty("playerTransform");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(playerT, new GUIContent("Player Transform", "The Transform of the Player"), true);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Player Transform");
                serializedObject.ApplyModifiedProperties();
            }
            tmpFloat = EditorGUILayout.Slider(new GUIContent("Raycast offset", "The distance off the target to avoid fading too much"), fader.offset, -2f, 0f);
            if (tmpFloat != fader.offset)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Raycast offset");
                fader.offset = tmpFloat;
            }
            string tmpString = EditorGUILayout.TagField(new GUIContent("Player Tag", "Select the player's tag"), fader.playerTag);

            if (tmpString != fader.playerTag)
            {
                isDirty = true;
                Undo.RecordObject(fader, "Player Tag");
                fader.playerTag = tmpString;
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();

            if (GUI.changed || isDirty)
            {
                EditorUtility.SetDirty(target); // or it won't save the data!!
            }
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;
            vista = (FSM)target;
            EditorGUILayout.Separator();
            Commons.SetColors(backColor, labelColor);
            Commons.DrawTexture(ResourceHelper.LogoFSM);
            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            EditorGUILayout.LabelField("IMPOSTAZIONE VISTA");
            bool tmpBool = EditorGUILayout.Toggle(new GUIContent("Vis. Area Vista", "Visualizza nella scena gli Handle della Vista"), vista.visualizzaHandleVista);

            if (tmpBool != vista.visualizzaHandleVista)
            {
                vista.visualizzaHandleAttacco = false;  //PER ORA FATTO PROVVISORIO..QUANDO CI SARAN PIU' ARMI SI FA UNA COSA DIVERSA
                isDirty = true;
                Undo.RecordObject(vista, "Vis. Handle Vista");
                vista.visualizzaHandleVista = tmpBool;
            }
            if (vista.visualizzaHandleVista)
            {
                tmpDist = EditorGUILayout.Slider(new GUIContent("Distanza Visibilita", "Quanto ci vedo senza occhiali"),
                                                 vista.quantoCiVedoSenzaOcchiali, 0.1f, 100f);
                if (tmpDist != vista.quantoCiVedoSenzaOcchiali)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Distanza Visibilita");
                    vista.quantoCiVedoSenzaOcchiali = tmpDist;
                }

                tmpArc = EditorGUILayout.Slider(new GUIContent("Dimensione Arco", "Dimensione Angolo arco"), vista.alphaGrad, 5f, 175f);
                if (tmpArc != vista.alphaGrad)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Dimensioni Arco");
                    vista.alphaGrad = tmpArc;
                }

                float tmpHanD1 = EditorGUILayout.Slider(new GUIContent("Dimensione Handle Vista", "Imposta la dimensione degli handle Vista in questo pannello"),
                                                        vista.dimensioneHandleVista, 0.1f, 15f);
                if (tmpHanD1 != vista.dimensioneHandleVista)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Distanza Handle Vista");
                    vista.dimensioneHandleVista = tmpHanD1;
                }
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("IMPOSTAZIONE PERCEZIONE VISIVA");
            tmpAmp = EditorGUILayout.Slider(new GUIContent("Ampiezza Percezione Vista", "Dimensione Ampiezza"), vista.ampiezza, 0f, 5f);
            if (tmpAmp != vista.ampiezza)
            {
                isDirty = true;
                Undo.RecordObject(vista, "Dimensioni Ampiezza");
                vista.ampiezza = tmpAmp;
            }

            tmpVel = EditorGUILayout.Slider(new GUIContent("Velocita oscillazione Vista", "Velocita Oscillazione"), vista.velocitaOscillazioneVista, 0f, 5f);
            if (tmpVel != vista.velocitaOscillazioneVista)
            {
                isDirty = true;
                Undo.RecordObject(vista, "Vel Oscil Vista");
                vista.velocitaOscillazioneVista = tmpVel;
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical(EditorStyles.objectFieldThumb);
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("IMPOSTAZIONE ARMI");
            bool tmpBol = EditorGUILayout.Toggle(new GUIContent("Vis. Area Attacco", "Visualizza nella scena gli Handle della Distanza Attacco"), vista.visualizzaHandleAttacco);

            if (tmpBol != vista.visualizzaHandleAttacco)
            {
                vista.visualizzaHandleVista = false;  //PER ORA FATTO PROVVISORIO..QUANDO CI SARAN PIU' ARMI SI FA UNA COSA DIVERSA
                isDirty = true;
                Undo.RecordObject(vista, "Vis. Handle Area Attacco");
                vista.visualizzaHandleAttacco = tmpBol;
            }
            if (vista.visualizzaHandleAttacco)
            {
                tmpDistArco = EditorGUILayout.Slider(new GUIContent("Arco Dist. Attacco", "Distanza Di Attacco del Arco Goblin"), vista.distanzaAttaccoGoblinArco, 0.1f, 30f);
                if (tmpDistArco != vista.distanzaAttaccoGoblinArco)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Arc Dist Attacco");
                    vista.distanzaAttaccoGoblinArco = tmpDistArco;
                }

                tmpDistSpada = EditorGUILayout.Slider(new GUIContent("Spada Dist. Attacco", "Distanza Di Attacco del Spada Goblin"), vista.distanzaAttaccoGoblinSpada, 0.1f, 30f);
                if (tmpDistSpada != vista.distanzaAttaccoGoblinSpada)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Spada Dist Attacco");
                    vista.distanzaAttaccoGoblinSpada = tmpDistSpada;
                }
                float tmpHanD2 = EditorGUILayout.Slider(new GUIContent("Dimensione Handle DistArmi", "Imposta la dimensione degli handle Distanza armi in questo pannello"),
                                                        vista.dimensioneHandleDistArmi, 1f, 15f);
                if (tmpHanD2 != vista.dimensioneHandleDistArmi)
                {
                    isDirty = true;
                    Undo.RecordObject(vista, "Dimensione Handle Distanza Armi");
                    vista.dimensioneHandleDistArmi = tmpHanD2;
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.Separator();
            }
            if (GUI.changed || isDirty)
            {
                EditorUtility.SetDirty(vista);
            }
        }