Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        if (_target.enabled == false)
            return;

        if (error != V_FR_ERROR.Ok && error != V_FR_ERROR.NotFractumMaterial)
        {
            GUILayout.Space(5);

            textStyle.normal.textColor = Color.red;
            EditorGUILayout.LabelField("Warning: " + error.ToString(), textStyle);

            About();

            return;
        }

        EditorGUI.BeginDisabledGroup(Application.isPlaying);
        {
            GUILayout.Space(10);

            string fragmentumTag = "FragmentumTag";
            string tag = _target.renderer.sharedMaterial.GetTag(fragmentumTag, false, "nothing");

            if (tag.IndexOf("Fragmentum") == -1)
            {
                error = V_FR_ERROR.NotFractumMaterial;

                GUILayout.Space(5);
                textStyle.normal.textColor = Color.red;
                EditorGUILayout.LabelField("Warning: " + error.ToString(), textStyle);

                About();

                return;
            }

        EditorGUI.EndDisabledGroup();

            GUILayout.Space(5);
            //Activator
            EditorGUI.BeginDisabledGroup(Application.isPlaying);
            _target.fActivator = (Fragmentum.FRAGMENTUM_ACTIVATOR)EditorGUILayout.EnumPopup("Activator", _target.fActivator);
            EditorGUI.EndDisabledGroup();
            if (_target.fActivator == Fragmentum.FRAGMENTUM_ACTIVATOR.Plane)
            {
                if (!_target.planeObject)
                    GUI.backgroundColor = Color.red;
                _target.planeObject = (Transform)EditorGUILayout.ObjectField("   Activator Object", _target.planeObject, typeof(Transform), true);
                GUI.backgroundColor = Color.white;
            }

            if (_target.fActivator == Fragmentum.FRAGMENTUM_ACTIVATOR.Sphere)
            {
                if (!_target.sphereObject)
                    GUI.backgroundColor = Color.red;

                _target.sphereObject = (Transform)EditorGUILayout.ObjectField("   Activator Object", _target.sphereObject, typeof(Transform), true);
                GUI.backgroundColor = Color.white;

                if (_target.sphereObjectRadius == 0)
                    GUI.backgroundColor = Color.red;
                _target.sphereObjectRadius = EditorGUILayout.FloatField("   Activator Radius", _target.sphereObjectRadius);
                GUI.backgroundColor = Color.white;
            }

        }

        EditorGUI.BeginDisabledGroup(Application.isPlaying);
        {
            GUILayout.Space(5);

            //_target.bUseNoise = EditorGUILayout.Toggle("Use Noise", _target.bUseNoise);

            UpdateShader();
        }

        EditorGUI.EndDisabledGroup();

        GUILayout.Space(10);
        _target.useUpdateFunction = EditorGUILayout.Toggle("Use Update Function", _target.useUpdateFunction);

        //Info();

        About();
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        if (_target.enabled == false)
            return;

        GUILayout.Space(5);
        GUI.backgroundColor = Color.red;
        if (GUILayout.Button("Fragmentum 2 is available.\n With SM2 and SM3 support.\nFor Mac, Linux, iOS and Android.", GUILayout.Height(60)))
        {
            Application.OpenURL("https://www.assetstore.unity3d.com/#/content/8264");
        }
        GUI.backgroundColor = Color.white;
        GUILayout.Space(5);

        if (error != V_FR_ERROR.Ok && error != V_FR_ERROR.NotFractumMaterial)
        {
            GUILayout.Space(5);

            textStyle.normal.textColor = Color.red;
            EditorGUILayout.LabelField("Warning: " + error.ToString(), textStyle);

            About();

            return;
        }

        EditorGUI.BeginDisabledGroup(Application.isPlaying);
        {
            GUILayout.Space(10);

            string fragmentumTag = "FragmentumTag";
            string tag = _target.renderer.sharedMaterial.GetTag(fragmentumTag, false, "nothing");

            if (tag.IndexOf("Fragmentum") == -1)
            {
                error = V_FR_ERROR.NotFractumMaterial;

                GUILayout.Space(5);
                textStyle.normal.textColor = Color.red;
                EditorGUILayout.LabelField("Warning: " + error.ToString(), textStyle);

                About();

                return;
            }

        EditorGUI.EndDisabledGroup();

            GUILayout.Space(5);
            //Activator
            EditorGUI.BeginDisabledGroup(Application.isPlaying);
            _target.fActivator = (Fragmentum.FRAGMENTUM_ACTIVATOR)EditorGUILayout.EnumPopup("Activator", _target.fActivator);
            EditorGUI.EndDisabledGroup();
            if (_target.fActivator == Fragmentum.FRAGMENTUM_ACTIVATOR.Plane)
            {
                if (!_target.planeObject)
                    GUI.backgroundColor = Color.red;
                _target.planeObject = (Transform)EditorGUILayout.ObjectField("   Activator Object", _target.planeObject, typeof(Transform), true);
                GUI.backgroundColor = Color.white;
            }

            if (_target.fActivator == Fragmentum.FRAGMENTUM_ACTIVATOR.Sphere)
            {
                if (!_target.sphereObject)
                    GUI.backgroundColor = Color.red;

                _target.sphereObject = (Transform)EditorGUILayout.ObjectField("   Activator Object", _target.sphereObject, typeof(Transform), true);
                GUI.backgroundColor = Color.white;

                if (_target.sphereObjectRadius == 0)
                    GUI.backgroundColor = Color.red;
                _target.sphereObjectRadius = EditorGUILayout.FloatField("   Activator Radius", _target.sphereObjectRadius);
                GUI.backgroundColor = Color.white;
            }

        }

        EditorGUI.BeginDisabledGroup(Application.isPlaying);
        {
            GUILayout.Space(5);

            //_target.bUseNoise = EditorGUILayout.Toggle("Use Noise", _target.bUseNoise);

            UpdateShader();
        }

        EditorGUI.EndDisabledGroup();

        GUILayout.Space(10);
        _target.useUpdateFunction = EditorGUILayout.Toggle("Use Update Function", _target.useUpdateFunction);

        //Info();

        About();
    }