63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using UnityEngine;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
|
|
namespace Net.Like.Xue.Tokyo.Weather
|
|
{
|
|
public class ScriptableWeather : ScriptableObject
|
|
{
|
|
#if UNITY_EDITOR
|
|
[SerializeField] private LightingDataAsset lightingDataAsset;
|
|
#endif
|
|
[SerializeField] private Vector3 sunLightDirection = new Vector3(0, 1, 0);
|
|
[SerializeField] private Color sunLightColor;
|
|
[SerializeField] private float sunLightIntensity = 1;
|
|
[SerializeField] private Material skyboxMaterial;
|
|
[SerializeField] private FogMode fogMode;
|
|
[SerializeField] private Color fogColor;
|
|
[SerializeField] private float fogDensity;
|
|
|
|
[BIT]
|
|
public void Save()
|
|
{
|
|
#if UNITY_EDITOR
|
|
lightingDataAsset = Lightmapping.lightingDataAsset;
|
|
#endif
|
|
|
|
sunLightDirection = RenderSettings.sun.transform.eulerAngles;
|
|
sunLightIntensity = RenderSettings.sun.intensity;
|
|
sunLightColor = RenderSettings.sun.color;
|
|
|
|
skyboxMaterial = RenderSettings.skybox;
|
|
|
|
fogMode = RenderSettings.fogMode;
|
|
fogColor = RenderSettings.fogColor;
|
|
fogDensity = RenderSettings.fogDensity;
|
|
#if UNITY_EDITOR
|
|
EditorUtility.SetDirty(this);
|
|
#endif
|
|
}
|
|
|
|
[BIT]
|
|
public void Load()
|
|
{
|
|
#if UNITY_EDITOR
|
|
Lightmapping.lightingDataAsset = lightingDataAsset;
|
|
#endif
|
|
RenderSettings.sun.transform.eulerAngles = sunLightDirection;
|
|
RenderSettings.sun.intensity = sunLightIntensity;
|
|
RenderSettings.skybox = skyboxMaterial;
|
|
RenderSettings.fogMode = fogMode;
|
|
RenderSettings.fogColor = fogColor;
|
|
RenderSettings.fogDensity = fogDensity;
|
|
}
|
|
}
|
|
|
|
}
|
|
|