コード例 #1
0
    void OnGUI()
    {
        GUILayout.Label("                                  Creador de luces", EditorStyles.boldLabel);
        GUI.DrawTexture(GUILayoutUtility.GetRect(50, 120), (Texture2D)Resources.Load("foco"));
        name            = EditorGUILayout.TextField("Name", name);
        op              = (options)EditorGUILayout.EnumPopup("Light Type", op);
        bounceintensity = EditorGUILayout.FloatField("Bounce Intencity", bounceintensity);
        spot            = EditorGUILayout.FloatField("Spot Angle", spot);
        intensity       = EditorGUILayout.FloatField("Intensidad", intensity);
        color           = EditorGUILayout.ColorField("color", color);
        Rect rectOpenNew = EditorGUILayout.BeginHorizontal("Button");

        if (GUI.Button(rectOpenNew, GUIContent.none))
        {
            lc                 = ScriptableObjectUtility.CreateAssetAndReturn <LightsConfig>();
            lc.name            = name;
            lc.bounceIntencity = bounceintensity;
            lc.spotValor       = spot;
            lc.intensity       = intensity;
            lc.color           = color;
            instantiateop(op);
            lc.type = luz;
            GameObject light = new GameObject(name);
            light.AddComponent <Light>();
            light.GetComponent <Light>().bounceIntensity = bounceintensity;
            light.GetComponent <Light>().spotAngle       = spot;
            light.GetComponent <Light>().intensity       = intensity;
            light.GetComponent <Light>().color           = color;
            light.GetComponent <Light>().type            = luz;
        }

        GUILayout.Label("create light");
        EditorGUILayout.EndHorizontal();
    }
コード例 #2
0
        private void parseScene()
        {
            // Create content file
            content = new Format4();
            lights  = new LightsConfig();
            if (options.tags.Length > 0)
            {
                tags = new TagsFormat();
                foreach (string tag in options.tags)
                {
                    tags.tags.Add(tag, new List <string>());
                }
                checkTags = true;
            }
            // Create base scene
            Scene3JS scene = new Scene3JS();

            scene.name   = SceneManager.GetActiveScene().name;
            scene.matrix = Utils.getMatrixAsArray(Matrix4x4.identity);
            // Checking if we have fog
            if (RenderSettings.fog)
            {
                Fog3JS fog = new Fog3JS();
                fog.color = Utils.getIntColor(RenderSettings.fogColor);
                switch (RenderSettings.fogMode)
                {
                case FogMode.Linear:
                    LinearFog3JS linearFog = new LinearFog3JS(fog);
                    linearFog.near = RenderSettings.fogStartDistance;
                    linearFog.far  = RenderSettings.fogEndDistance;
                    scene.fog      = linearFog;
                    break;

                case FogMode.Exponential:
                case FogMode.ExponentialSquared:
                    ExpFog3JS expFog = new ExpFog3JS(fog);
                    expFog.density = RenderSettings.fogDensity;
                    scene.fog      = expFog;
                    break;
                }
            }
            scene.children.Add(createAmbientLight());
            content.@object = scene;
            // Enumerate through all the objects
            GameObject[] rootObjects = SceneManager.GetActiveScene().GetRootGameObjects();
            foreach (GameObject gameObject in rootObjects)
            {
                Object3JS obj = parseGameObject(gameObject);
                if (obj != null)
                {
                    scene.children.Add(obj);
                }
            }
            updateProgressWithMessage("Writing JSON file");
        }
コード例 #3
0
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     data = (LightsConfig)EditorGUILayout.ObjectField("Config", data, typeof(LightsConfig), true);
     if (data != null)
     {
         if (GUI.changed)
         {
             _target.intensity       = data.intensity;
             _target.color           = data.color;
             _target.spotAngle       = data.spotValor;
             _target.bounceIntensity = data.bounceIntencity;
             _target.type            = data.type;
         }
     }
 }
コード例 #4
0
 private void OnEnable()
 {
     _target = (LightsConfig)target;
 }