Readd missing import files
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a09b09a015393844493ce99cdff52102
|
||||
folderAsset: yes
|
||||
timeCreated: 1532145127
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d622a7aa568686f41be55fee23f7d94e
|
||||
folderAsset: yes
|
||||
timeCreated: 1502198070
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Get AQUAS here on Asset Store: https://www.assetstore.unity3d.com/en/#!/content/52103
|
||||
|
||||
After you have added your AQUAS objects in scene, add the Enviro AQUAS Integration component on each of your water objects. Now assign the "Water Object" fields with corresponding AQUAS Water objects.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f3a7df94d5335a4c94c04cf53240463
|
||||
timeCreated: 1502721811
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4475e9e91a01ae74d805a1ae4eb367ff
|
||||
timeCreated: 1555356446
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
#if AQUAS_PRESENT
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[AddComponentMenu("Enviro/Integration/AQUAS Integration")]
|
||||
public class EnviroAquasIntegration : MonoBehaviour {
|
||||
|
||||
[Header("AQUAS Water Plane")]
|
||||
public GameObject waterObject;
|
||||
|
||||
[Header("Setup")]
|
||||
public bool deactivateAquasReflectionProbe = true;
|
||||
public bool deactivateEnviroFogUnderwater = true;
|
||||
|
||||
[Header("Settings")]
|
||||
[Range(0f,1f)]
|
||||
public float underwaterFogColorInfluence = 0.3f;
|
||||
//
|
||||
//private GameObject enviroWaterDepth;
|
||||
private AQUAS_LensEffects aquasUnderWater;
|
||||
private bool isUnderWater;
|
||||
//
|
||||
|
||||
private bool defaultDistanceFog;
|
||||
private bool defaultHeightFog;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
{
|
||||
Debug.Log ("No EnviroSky Manager in scene! This component will be disabled!");
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(GameObject.Find ("UnderWaterCameraEffects") != null)
|
||||
aquasUnderWater = GameObject.Find ("UnderWaterCameraEffects").GetComponent<AQUAS_LensEffects> ();
|
||||
|
||||
defaultDistanceFog = EnviroSkyMgr.instance.FogSettings.distanceFog;
|
||||
defaultHeightFog = EnviroSkyMgr.instance.FogSettings.heightFog;
|
||||
|
||||
SetupEnviroWithAQUAS ();
|
||||
}
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
//Check if we are underwater! Deactivate the workaround plane and enviro fog.
|
||||
if (waterObject != null && aquasUnderWater != null) {
|
||||
if (aquasUnderWater.underWater && !isUnderWater) {
|
||||
if (deactivateEnviroFogUnderwater) {
|
||||
EnviroSkyMgr.instance.FogSettings.distanceFog = false;
|
||||
EnviroSkyMgr.instance.FogSettings.heightFog = false;
|
||||
EnviroSkyMgr.instance.CustomFogIntensity = underwaterFogColorInfluence;
|
||||
|
||||
}
|
||||
EnviroSkyMgr.instance.UpdateFogIntensity = false;
|
||||
EnviroSkyMgr.instance.ambientAudioVolumeModifier = -1f;
|
||||
EnviroSkyMgr.instance.weatherAudioVolumeModifier = -1f;
|
||||
isUnderWater = true;
|
||||
} else if (!aquasUnderWater.underWater && isUnderWater) {
|
||||
if (deactivateEnviroFogUnderwater) {
|
||||
EnviroSkyMgr.instance.UpdateFogIntensity = true;
|
||||
EnviroSkyMgr.instance.FogSettings.distanceFog = defaultDistanceFog;
|
||||
EnviroSkyMgr.instance.FogSettings.heightFog = defaultHeightFog;
|
||||
RenderSettings.fogDensity = EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.fogDensity;
|
||||
EnviroSkyMgr.instance.CustomFogColor = aquasUnderWater.underWaterParameters.fogColor;
|
||||
EnviroSkyMgr.instance.CustomFogIntensity = 0f;
|
||||
}
|
||||
EnviroSkyMgr.instance.ambientAudioVolumeModifier = 0f;
|
||||
EnviroSkyMgr.instance.weatherAudioVolumeModifier = 0f;
|
||||
isUnderWater = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupEnviroWithAQUAS ()
|
||||
{
|
||||
if (waterObject != null) {
|
||||
|
||||
if (deactivateAquasReflectionProbe)
|
||||
DeactivateReflectionProbe (waterObject);
|
||||
|
||||
if (EnviroSkyMgr.instance.FogSettings.distanceFog == false && EnviroSkyMgr.instance.FogSettings.heightFog == false)
|
||||
deactivateEnviroFogUnderwater = false;
|
||||
|
||||
if (aquasUnderWater != null)
|
||||
aquasUnderWater.setAfloatFog = false;
|
||||
|
||||
} else {
|
||||
Debug.Log ("AQUAS Object not found! This component will be disabled!");
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DeactivateReflectionProbe (GameObject aquas)
|
||||
{
|
||||
GameObject probe = GameObject.Find (aquas.name + "/Reflection Probe");
|
||||
if (probe != null)
|
||||
probe.GetComponent<ReflectionProbe> ().enabled = false;
|
||||
else
|
||||
Debug.Log ("Cannot find AQUAS Reflection Probe!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3d2279d52cfe4049ba3f847b3b46726
|
||||
timeCreated: 1502235225
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9532d63f37079e644acbc07776aa6f0b
|
||||
folderAsset: yes
|
||||
timeCreated: 1498229797
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Get CTS Terrain Shader here: https://www.assetstore.unity3d.com/en/#!/content/91938
|
||||
|
||||
Once imported the EnviroCTSIntegration component can be used to synchronize enviro with CTS.
|
||||
|
||||
1. Add the CTS Weather Manager to your scene. "Component" -> "CTS" -> "Add Weather Manager"
|
||||
2. Now add the EnviroCTSIntegration component to the EnviroSky object in your scene.
|
||||
"Component" -> "Enviro" -> "Integrations" -> "CTS Integration"
|
||||
3. Enable the features you want to synchronize with CTS.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6eff49eb08797049849d8c86b37546c
|
||||
timeCreated: 1501341820
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if CTS_PRESENT
|
||||
using CTS;
|
||||
|
||||
[AddComponentMenu("Enviro/Integration/CTS Integration")]
|
||||
public class EnviroCTSIntegration : MonoBehaviour {
|
||||
|
||||
public CTSWeatherManager ctsWeatherManager;
|
||||
|
||||
public bool updateSnow;
|
||||
public bool updateWetness;
|
||||
public bool updateSeasons;
|
||||
|
||||
private float daysInYear;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (ctsWeatherManager == null) {
|
||||
ctsWeatherManager = GameObject.FindObjectOfType<CTSWeatherManager> ();
|
||||
}
|
||||
|
||||
if(ctsWeatherManager == null) {
|
||||
Debug.LogWarning("CTS WeatherManager not found! Component -> CTS -> Add Weather Manager");
|
||||
return;
|
||||
}
|
||||
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
Debug.LogWarning("EnviroSky Manager not found! Please add Enviro Manager to your scene!");
|
||||
return;
|
||||
}
|
||||
daysInYear = EnviroSkyMgr.instance.Time.DaysInYear;
|
||||
}
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (ctsWeatherManager == null || EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (updateSnow)
|
||||
ctsWeatherManager.SnowPower = EnviroSkyMgr.instance.GetSnowIntensity();
|
||||
|
||||
if(updateWetness)
|
||||
ctsWeatherManager.RainPower = EnviroSkyMgr.instance.GetWetnessIntensity();
|
||||
|
||||
if (updateSeasons) {
|
||||
ctsWeatherManager.Season = Mathf.Lerp (0f, 4f, EnviroSkyMgr.instance.GetCurrentDay() / daysInYear);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfb7c0c2c0290104193a8c715ece108d
|
||||
timeCreated: 1498211786
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d7f625dfc1d73b488379e97a7765e17
|
||||
folderAsset: yes
|
||||
timeCreated: 1535894292
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ddfdf509f2a7744ead5607bda9e33f6
|
||||
folderAsset: yes
|
||||
timeCreated: 1535590339
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(EnviroFogVolumeIntegration))]
|
||||
public class EnviroFogVolumeEditor : Editor {
|
||||
#if ENVIRO_FV3_SUPPORT
|
||||
private GUIStyle boxStyle;
|
||||
private GUIStyle wrapStyle;
|
||||
private GUIStyle headerStyle;
|
||||
|
||||
SerializedObject serializedObj;
|
||||
private EnviroFogVolumeIntegration myTarget;
|
||||
|
||||
SerializedProperty clouds,fog,cloudsPosition,fogPosition,moveWithPlayer;
|
||||
SerializedProperty coverageMult, absorbtionMult, visibilityMult, renderIntensityMult, fogColorPower;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroFogVolumeIntegration)target;
|
||||
serializedObj = new SerializedObject (myTarget);
|
||||
|
||||
clouds = serializedObj.FindProperty ("clouds");
|
||||
fog = serializedObj.FindProperty ("fog");
|
||||
moveWithPlayer = serializedObj.FindProperty ("moveWithPlayer");
|
||||
cloudsPosition = serializedObj.FindProperty ("cloudsPosition");
|
||||
fogPosition = serializedObj.FindProperty ("fogPosition");
|
||||
absorbtionMult = serializedObj.FindProperty ("absorbtionMult");
|
||||
visibilityMult = serializedObj.FindProperty ("visibilityMult");
|
||||
renderIntensityMult = serializedObj.FindProperty ("renderIntensityMult");
|
||||
coverageMult = serializedObj.FindProperty ("coverageMult");
|
||||
fogColorPower = serializedObj.FindProperty ("fogColorPower");
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
if (boxStyle == null)
|
||||
{
|
||||
boxStyle = new GUIStyle(GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Normal;
|
||||
wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
if (headerStyle == null)
|
||||
{
|
||||
headerStyle = new GUIStyle(GUI.skin.label);
|
||||
headerStyle.fontStyle = FontStyle.Bold;
|
||||
headerStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
serializedObj.UpdateIfRequiredOrScript ();
|
||||
#else
|
||||
serializedObj.UpdateIfDirtyOrScript ();
|
||||
#endif
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
GUILayout.BeginVertical("Enviro - FogVolume 3 Integration", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("Welcome to the FogVolume 3 Integration for Enviro - Sky and Weather!", wrapStyle);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
GUILayout.BeginVertical("Setup", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
#if GAIA_PRESENT
|
||||
if (GUILayout.Button ("Get from GAIA")) {
|
||||
myTarget.GetFromGaia ();
|
||||
}
|
||||
#endif
|
||||
GUILayout.BeginHorizontal ("",boxStyle);
|
||||
if (GUILayout.Button ("Create Clouds")) {
|
||||
myTarget.CreateCloudLayer ();
|
||||
}
|
||||
if (GUILayout.Button ("Create Uniform Fog")) {
|
||||
myTarget.CreateUniformFog ();
|
||||
}
|
||||
//if (GUILayout.Button ("Create Textured Fog")) {
|
||||
// myTarget.CreateTexturedFog ();
|
||||
//}
|
||||
GUILayout.EndHorizontal ();
|
||||
EditorGUILayout.PropertyField (clouds, true, null);
|
||||
EditorGUILayout.PropertyField (fog, true, null);
|
||||
EditorGUILayout.PropertyField (cloudsPosition, true, null);
|
||||
EditorGUILayout.PropertyField (fogPosition, true, null);
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical ("Movement Settings",boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.PropertyField (moveWithPlayer, true, null);
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Controls", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.PropertyField (coverageMult, true, null);
|
||||
EditorGUILayout.PropertyField (absorbtionMult, true, null);
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.LabelField ("Fog Runtime Setting",headerStyle);
|
||||
if(myTarget.fogMode == EnviroFogVolumeIntegration.CurrentFogMode.None)
|
||||
EditorGUILayout.LabelField ("Current Fog Mode: None");
|
||||
else if(myTarget.fogMode == EnviroFogVolumeIntegration.CurrentFogMode.Uniform)
|
||||
EditorGUILayout.LabelField ("Current Fog Mode: Uniform");
|
||||
else
|
||||
EditorGUILayout.LabelField ("Current Fog Mode: Textured");
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.PropertyField (fogColorPower, true, null);
|
||||
if(myTarget.fogMode == EnviroFogVolumeIntegration.CurrentFogMode.Uniform)
|
||||
EditorGUILayout.PropertyField (visibilityMult, true, null);
|
||||
if(myTarget.fogMode == EnviroFogVolumeIntegration.CurrentFogMode.Textured)
|
||||
EditorGUILayout.PropertyField (renderIntensityMult, true, null);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
if (EditorGUI.EndChangeCheck ()) {
|
||||
serializedObj.ApplyModifiedProperties ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c41aec5c4002e0489fdbb2885c0b82b
|
||||
timeCreated: 1504279655
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+397
@@ -0,0 +1,397 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if ENVIRO_FV3_SUPPORT
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Enviro/Integration/Fog Volume 3 Integration")]
|
||||
#endif
|
||||
public class EnviroFogVolumeIntegration : MonoBehaviour {
|
||||
#if ENVIRO_FV3_SUPPORT
|
||||
public enum CurrentFogMode
|
||||
{
|
||||
None,
|
||||
Uniform,
|
||||
Textured
|
||||
}
|
||||
|
||||
|
||||
public CurrentFogMode fogMode;
|
||||
|
||||
[Header("Fog Volume Objects")]
|
||||
public FogVolume clouds;
|
||||
public FogVolume fog;
|
||||
|
||||
[Header("Creation Settings")]
|
||||
public Vector3 cloudsPosition = new Vector3 (0f,250f,0f);
|
||||
public Vector3 fogPosition = new Vector3 (0f,200f,0f);
|
||||
|
||||
public bool moveWithPlayer = true;
|
||||
|
||||
[Header("Clouds Runtime Settings")]
|
||||
[Range(0f,10f)]
|
||||
public float coverageMult = 3f;
|
||||
[Range(0f,2f)]
|
||||
public float absorbtionMult = 1.2f;
|
||||
|
||||
[Range(0f,1f)]
|
||||
public float fogColorPower = 0.75f;
|
||||
[Range(0f,1f)]
|
||||
public float visibilityMult = 0.1f;
|
||||
[Range(0f,1f)]
|
||||
public float renderIntensityMult = 0.1f;
|
||||
|
||||
private Light myLight;
|
||||
private float cloudCoverage;
|
||||
|
||||
void Start () {
|
||||
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
this.enabled = false;
|
||||
Debug.Log ("Deactivated Fog Volume Integration. No EnviroSkyMgr instance in scene!");
|
||||
return;
|
||||
}
|
||||
myLight = EnviroSkyMgr.instance.Components.DirectLight.GetComponent<Light>();
|
||||
|
||||
if (fog == null)
|
||||
fogMode = CurrentFogMode.None;
|
||||
}
|
||||
|
||||
//Control the fog and Clouds based on time of day and weather.
|
||||
void Update ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
//Clouds
|
||||
if (clouds != null)
|
||||
{
|
||||
//Set cloud coverage based on first enviro layer.
|
||||
cloudCoverage = 0f;
|
||||
// Set cloud time and weather based weather colors.
|
||||
clouds.InscatteringColor = myLight.color;
|
||||
clouds._AmbientColor = EnviroSkyMgr.instance.CloudSettings.volumeCloudsColor.Evaluate (EnviroSkyMgr.instance.Time.solarTime) * RenderSettings.fogColor;
|
||||
|
||||
cloudCoverage = EnviroSkyMgr.instance.Clouds.coverage;
|
||||
clouds.Coverage = Mathf.Clamp(cloudCoverage * coverageMult,0f,5f);
|
||||
clouds.Absorption = (1.01f - EnviroSkyMgr.instance.Clouds.ambientSkyColorIntensity) * absorbtionMult;
|
||||
}
|
||||
|
||||
//Ground Fog
|
||||
if (fog != null)
|
||||
{
|
||||
fog.FogMainColor = EnviroSkyMgr.instance.CloudSettings.volumeCloudsColor.Evaluate (EnviroSkyMgr.instance.Time.solarTime) * (RenderSettings.fogColor * fogColorPower);
|
||||
fog._AmbientColor = RenderSettings.ambientLight;
|
||||
fog.InscatteringColor = myLight.color;
|
||||
fog.VolumeFogInscatteringColor = myLight.color;
|
||||
|
||||
if (fogMode == CurrentFogMode.Uniform)
|
||||
fog.Visibility = (1f - RenderSettings.fogDensity) * 500f * visibilityMult;
|
||||
else
|
||||
fog.Visibility = 1f;
|
||||
|
||||
if (fogMode == CurrentFogMode.Textured)
|
||||
fog.NoiseIntensity = Mathf.Clamp01(RenderSettings.fogDensity * 500f * renderIntensityMult);
|
||||
|
||||
fog.Absorption = Mathf.Clamp01(1.01f- EnviroSkyMgr.instance.Time.solarTime);
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate ()
|
||||
{
|
||||
if (moveWithPlayer) {
|
||||
|
||||
if (clouds != null) {
|
||||
clouds.transform.position = new Vector3 (EnviroSkyMgr.instance.Player.transform.position.x, clouds.transform.position.y, EnviroSkyMgr.instance.Player.transform.position.z);
|
||||
}
|
||||
|
||||
if (fog != null) {
|
||||
fog.transform.position = new Vector3 (EnviroSkyMgr.instance.Player.transform.position.x, fog.transform.position.y, EnviroSkyMgr.instance.Player.transform.position.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetFromGaia()
|
||||
{
|
||||
FogVolume gFV = null;
|
||||
FogVolume cloudsFV = null;
|
||||
|
||||
|
||||
GameObject groundFog = GameObject.Find("Fog Volume [Ground Fog]");
|
||||
if(groundFog != null)
|
||||
gFV = groundFog.GetComponent<FogVolume>();
|
||||
|
||||
if (gFV != null)
|
||||
fog = gFV;
|
||||
|
||||
GameObject cloudsGo = GameObject.Find("Fog Volume [Clouds]");
|
||||
if(cloudsGo != null)
|
||||
cloudsFV = cloudsGo.GetComponent<FogVolume>();
|
||||
|
||||
if (cloudsFV != null)
|
||||
clouds = cloudsFV;
|
||||
}
|
||||
|
||||
public void CreateUniformFog()
|
||||
{
|
||||
fogMode = CurrentFogMode.Uniform;
|
||||
//Pick colour of main light
|
||||
Color mainLightColor = Color.white;
|
||||
mainLightColor = EnviroSkyMgr.instance.Components.DirectLight.GetComponent<Light>().color;
|
||||
|
||||
GameObject groundFogGo = GameObject.Find("Fog Volume [Ground Fog] for Enviro");
|
||||
|
||||
DestroyImmediate (groundFogGo);
|
||||
|
||||
if (groundFogGo == null)
|
||||
{
|
||||
groundFogGo = new GameObject();
|
||||
groundFogGo.name = "Fog Volume [Ground Fog] for Enviro";
|
||||
Renderer rend = groundFogGo.AddComponent<MeshRenderer>();
|
||||
if (rend != null) {
|
||||
rend.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
rend.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
|
||||
rend.receiveShadows = false;
|
||||
rend.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off;
|
||||
}
|
||||
groundFogGo.AddComponent<FogVolume>();
|
||||
}
|
||||
|
||||
//Adjust Fog Settings
|
||||
FogVolume fVolume = groundFogGo.GetComponent<FogVolume>();
|
||||
if (fVolume != null)
|
||||
{
|
||||
fVolume.transform.position = fogPosition;
|
||||
fVolume.fogVolumeScale = new Vector3(EnviroSkyMgr.instance.Camera.farClipPlane, EnviroSkyMgr.instance.Camera.farClipPlane * 0.2f, EnviroSkyMgr.instance.Camera.farClipPlane);
|
||||
fVolume.FogMainColor = Color.grey;
|
||||
fVolume.Visibility = 800f;
|
||||
fVolume.EnableInscattering = true;
|
||||
fVolume.InscatteringColor = Color.Lerp(mainLightColor, Color.black, 0.8f);
|
||||
fVolume.VolumeFogInscatteringAnisotropy = 0.59f;
|
||||
fVolume.InscatteringIntensity = 0.07f;
|
||||
fVolume.InscatteringStartDistance = 5f;
|
||||
fVolume.InscatteringTransitionWideness = 300f;
|
||||
fVolume.DrawOrder = 3;
|
||||
fVolume._PushAlpha = 1.0025f;
|
||||
fVolume._ztest = UnityEngine.Rendering.CompareFunction.Always;
|
||||
|
||||
// Assign Fog for runtime Controls
|
||||
fog = fVolume;
|
||||
CheckCamera ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void CreateTexturedFog()
|
||||
{
|
||||
fogMode = CurrentFogMode.Textured;
|
||||
|
||||
//Pick colour of main light
|
||||
Color mainLightColor = Color.white;
|
||||
mainLightColor = EnviroSkyMgr.instance.Components.DirectLight.GetComponent<Light>().color;
|
||||
|
||||
GameObject groundFogGo = GameObject.Find("Fog Volume [Ground Fog] for Enviro");
|
||||
|
||||
DestroyImmediate (groundFogGo);
|
||||
|
||||
if (groundFogGo == null)
|
||||
{
|
||||
groundFogGo = new GameObject();
|
||||
groundFogGo.name = "Fog Volume [Ground Fog] for Enviro";
|
||||
Renderer rend = groundFogGo.AddComponent<MeshRenderer>();
|
||||
if (rend != null) {
|
||||
rend.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
rend.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
|
||||
rend.receiveShadows = false;
|
||||
rend.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off;
|
||||
}
|
||||
groundFogGo.AddComponent<FogVolume>();
|
||||
}
|
||||
|
||||
//Adjust Fog Settings
|
||||
FogVolume fVolume = groundFogGo.GetComponent<FogVolume>();
|
||||
if (fVolume != null)
|
||||
{
|
||||
fVolume.transform.position = fogPosition;
|
||||
fVolume.fogVolumeScale = new Vector3(EnviroSkyMgr.instance.Camera.farClipPlane, EnviroSkyMgr.instance.Camera.farClipPlane * 0.2f, EnviroSkyMgr.instance.Camera.farClipPlane);
|
||||
fVolume.FogMainColor = Color.grey;
|
||||
fVolume.Visibility = 800f;
|
||||
|
||||
fVolume._FogType = FogVolume.FogType.Textured;
|
||||
fVolume.EnableGradient = true;
|
||||
fVolume.bVolumeFog = false;
|
||||
fVolume._BlendMode = FogVolumeRenderer.BlendMode.PremultipliedTransparency;
|
||||
|
||||
fVolume.EnableInscattering = true;
|
||||
fVolume.InscatteringColor = Color.Lerp(mainLightColor, Color.black, 0.8f);
|
||||
fVolume.VolumeFogInscatteringAnisotropy = 0.59f;
|
||||
fVolume.InscatteringIntensity = 0.07f;
|
||||
fVolume.InscatteringStartDistance = 5f;
|
||||
fVolume.InscatteringTransitionWideness = 300f;
|
||||
|
||||
|
||||
fVolume.DrawOrder = 3;
|
||||
fVolume._PushAlpha = 1.0025f;
|
||||
fVolume._ztest = UnityEngine.Rendering.CompareFunction.Always;
|
||||
|
||||
// Assign Fog for runtime Controls
|
||||
fog = fVolume;
|
||||
CheckCamera ();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Clouds Layer for Enviro.
|
||||
/// </summary>
|
||||
public void CreateCloudLayer ()
|
||||
{
|
||||
//Pick colour of main light
|
||||
Color mainLightColor = Color.white;
|
||||
|
||||
mainLightColor = EnviroSkyMgr.instance.Components.DirectLight.GetComponent<Light>().color;
|
||||
|
||||
//Get the main camera
|
||||
Camera mainCamera = Camera.main;
|
||||
|
||||
//First make sure its not already in scene - if it isnt then add it
|
||||
FogVolume fVolume;
|
||||
GameObject goClouds = GameObject.Find("Fog Volume [Clouds] for Enviro");
|
||||
|
||||
if (goClouds == null)
|
||||
{
|
||||
|
||||
goClouds = new GameObject();
|
||||
goClouds.name = "Fog Volume [Clouds] for Enviro";
|
||||
Renderer rend = goClouds.AddComponent<MeshRenderer>();
|
||||
if (rend != null) {
|
||||
rend.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
rend.receiveShadows = false;
|
||||
rend.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
|
||||
rend.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off;
|
||||
}
|
||||
fVolume = goClouds.AddComponent<FogVolume>();
|
||||
//Create the horizon
|
||||
GameObject goHorizon = GameObject.CreatePrimitive(PrimitiveType.Plane);
|
||||
goHorizon.name = "Horizon";
|
||||
goHorizon.transform.parent = goClouds.transform;
|
||||
goHorizon.transform.localPosition = new Vector3(0f, -79f, 0f);
|
||||
goHorizon.GetComponent<MeshRenderer>().enabled = false;
|
||||
goHorizon.GetComponent<MeshCollider>().enabled = false;
|
||||
|
||||
//Create the priority script
|
||||
FogVolumePriority fogVolumePrio = goClouds.AddComponent<FogVolumePriority>();
|
||||
fogVolumePrio.GameCamera = mainCamera;
|
||||
fogVolumePrio.FogOrderCameraAbove = 4;
|
||||
fogVolumePrio.FogOrderCameraBelow = -1;
|
||||
fogVolumePrio.thisFog = fVolume;
|
||||
fogVolumePrio.Horizon = goHorizon;
|
||||
|
||||
CheckCamera ();
|
||||
}
|
||||
|
||||
//Setup our clouds
|
||||
fVolume = goClouds.GetComponent<FogVolume>();
|
||||
|
||||
if (fVolume != null)
|
||||
{
|
||||
clouds = fVolume;
|
||||
|
||||
//Location and scale
|
||||
fVolume.transform.position = cloudsPosition;
|
||||
fVolume.fogVolumeScale = new Vector3(EnviroSkyMgr.instance.Camera.farClipPlane - 50f, 100f, EnviroSkyMgr.instance.Camera.farClipPlane - 50f);
|
||||
|
||||
//Fog type and blend mode
|
||||
fVolume._FogType = FogVolume.FogType.Textured;
|
||||
fVolume._BlendMode = FogVolumeRenderer.BlendMode.TraditionalTransparency;
|
||||
|
||||
//Lighting
|
||||
fVolume._AmbientColor = Color.Lerp(mainLightColor, Color.black, 0.1f);
|
||||
fVolume.useHeightGradient = true;
|
||||
fVolume.Absorption = 0.8f;
|
||||
fVolume.HeightAbsorption = 0.185f;
|
||||
fVolume.bAbsorption = true;
|
||||
|
||||
fVolume.EnableInscattering = true;
|
||||
fVolume.InscatteringColor = mainLightColor;
|
||||
fVolume.InscatteringShape = 0.05f;
|
||||
fVolume.InscatteringIntensity = 0.882f;
|
||||
fVolume.InscatteringStartDistance = 0f;
|
||||
fVolume.InscatteringTransitionWideness = 1f;
|
||||
|
||||
fVolume._DirectionalLighting = true;
|
||||
fVolume.LightExtinctionColor = Color.Lerp(mainLightColor, Color.black, 0.8f);
|
||||
fVolume._DirectionalLightingDistance = 0.0008f;
|
||||
fVolume.DirectLightingShadowDensity = 6f;
|
||||
fVolume.DirectLightingShadowSteps = 1;
|
||||
|
||||
//Renderer
|
||||
fVolume.NoiseIntensity = 1f;
|
||||
fVolume.SceneCollision = true;
|
||||
fVolume.Iterations = 500;
|
||||
fVolume.IterationStep = 100;
|
||||
fVolume._OptimizationFactor = 0.0000005f;
|
||||
|
||||
fVolume.GradMin = 0.19f;
|
||||
fVolume.GradMax = 0.06f;
|
||||
fVolume.GradMin2 = -0.25f;
|
||||
fVolume.GradMax2 = 0.21f;
|
||||
|
||||
//Noise
|
||||
fVolume.EnableNoise = true;
|
||||
fVolume._3DNoiseScale = 0.15f;
|
||||
fVolume.Speed = new Vector4(0.49f, 0f, 0f, 0f);
|
||||
fVolume.Vortex = 0.47f;
|
||||
fVolume.RotationSpeed = 0f;
|
||||
fVolume.rotation = 324f;
|
||||
fVolume._VortexAxis = FogVolume.VortexAxis.Y;
|
||||
fVolume.Coverage = 2.44f;
|
||||
fVolume.NoiseContrast = 12.9f;
|
||||
fVolume.NoiseDensity = 0.2f;
|
||||
fVolume.Octaves = 3;
|
||||
fVolume.BaseTiling = 150f;
|
||||
fVolume._BaseRelativeSpeed = 0.85f;
|
||||
fVolume.DetailTiling = 285.3f;
|
||||
fVolume._DetailRelativeSpeed = 16.6f;
|
||||
fVolume.DetailDistance = 5000f;
|
||||
fVolume._NoiseDetailRange = 0.337f;
|
||||
fVolume._DetailMaskingThreshold = 8f;
|
||||
fVolume._Curl = 0.364f;
|
||||
|
||||
//Other
|
||||
fVolume.DrawOrder = 4;
|
||||
fVolume._PushAlpha = 1.5f;
|
||||
fVolume._ztest = UnityEngine.Rendering.CompareFunction.LessEqual;
|
||||
|
||||
if(fogMode != CurrentFogMode.Textured)
|
||||
fVolume.CreateSurrogate = true;
|
||||
else
|
||||
fVolume.CreateSurrogate = false;
|
||||
|
||||
CheckCamera ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CheckCamera ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance.Camera != null) {
|
||||
FogVolumeRenderer renderer = EnviroSkyMgr.instance.Camera.gameObject.GetComponent<FogVolumeRenderer> ();
|
||||
|
||||
if (renderer == null)
|
||||
renderer = EnviroSkyMgr.instance.Camera.gameObject.AddComponent<FogVolumeRenderer> ();
|
||||
|
||||
if (renderer != null) {
|
||||
renderer._Downsample = 3;
|
||||
|
||||
if (fogMode == CurrentFogMode.Textured) {
|
||||
renderer.GenerateDepth = true;
|
||||
if(clouds != null)
|
||||
clouds.CreateSurrogate = false;
|
||||
} else {
|
||||
renderer.GenerateDepth = false;
|
||||
clouds.CreateSurrogate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68774a05ac57eab40b5a2d42fd3ce05c
|
||||
timeCreated: 1535590339
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Get Fog Volume 3 from Asset Store: https://www.assetstore.unity3d.com/en/#!/content/81802
|
||||
|
||||
Please note this integration component is work in progress!
|
||||
|
||||
Unpack the .rar archive and add the Enviro FogVolume Integration component to one of your gameobjects in your scene and assign your FogVolume - Clouds and Fog object. You also can leave it unassigned if you only want to use clouds or fog. You can add the component through unity component menu:
|
||||
"Enviro" -> "Integration" -> "Fog Volume 3 Integration"
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 940e9fac2c1f584449062497cc1d1c08
|
||||
timeCreated: 1502721457
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d0b31ee77c04a14f8c50302080b3b0f
|
||||
folderAsset: yes
|
||||
timeCreated: 1488951185
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
#if (GAIA_PRESENT || GAIA_2_PRESENT) && UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Gaia.GX.HendrikHaupt
|
||||
{
|
||||
/// <summary>
|
||||
/// Enviro - Sky and Weather for Gaia.
|
||||
/// </summary>
|
||||
public class EnviroWithGAIA : MonoBehaviour
|
||||
{
|
||||
#region Generic informational methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns the publisher name if provided.
|
||||
/// This will override the publisher name in the namespace ie Gaia.GX.PublisherName
|
||||
/// </summary>
|
||||
/// <returns>Publisher name</returns>
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Hendrik Haupt";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the package name if provided
|
||||
/// This will override the package name in the class name ie public class PackageName.
|
||||
/// </summary>
|
||||
/// <returns>Package name</returns>
|
||||
public static string GetPackageName()
|
||||
{
|
||||
return "Enviro - Sky and Weather";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods exposed by Gaia as buttons must be prefixed with GX_
|
||||
|
||||
public static void GX_About()
|
||||
{
|
||||
EditorUtility.DisplayDialog("About Enviro - Sky and Weather", "Enviro - Sky and Weather simulates day-night cycle, clouds, weather and seasons!", "OK");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add and configure Enviro in your scene.
|
||||
/// </summary>
|
||||
#if ENVIRO_HD
|
||||
public static void GX_AddEnviroSkyStandard()
|
||||
{
|
||||
// Search for Camera!
|
||||
Camera cam = Camera.main;
|
||||
|
||||
if (cam == null)
|
||||
{
|
||||
cam = FindObjectOfType<Camera>();
|
||||
}
|
||||
|
||||
if (cam == null)
|
||||
{
|
||||
EditorUtility.DisplayDialog("OOPS!", "Could not find a camera. Please add a camera to your scene.", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for Player
|
||||
GameObject plr = GameObject.Find("Player");
|
||||
|
||||
if (plr == null)
|
||||
{
|
||||
plr = GameObject.FindWithTag("Player");
|
||||
}
|
||||
|
||||
if (plr == null)
|
||||
{
|
||||
plr = cam.gameObject;
|
||||
}
|
||||
|
||||
// Check if there already is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance != null)
|
||||
{
|
||||
//Add and activate an instance
|
||||
EnviroSkyMgr.instance.CreateEnviroHDInstance();
|
||||
EnviroSkyMgr.instance.ActivateHDInstance();
|
||||
// Assign and start Enviro!
|
||||
EnviroSkyMgr.instance.AssignAndStart(plr, cam);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GameObject EnviroSkyPrefab = null;
|
||||
EnviroSkyPrefab = CreateManager ();
|
||||
|
||||
SetupScene(cam);
|
||||
|
||||
//Add and activate an instance
|
||||
EnviroSkyMgr.instance.CreateEnviroHDInstance();
|
||||
EnviroSkyMgr.instance.ActivateHDInstance();
|
||||
// Assign and start Enviro!
|
||||
EnviroSkyMgr.instance.AssignAndStart(plr, cam);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENVIRO_LW
|
||||
public static void GX_AddEnviroSkyLite()
|
||||
{
|
||||
// Search for Camera!
|
||||
Camera cam = Camera.main;
|
||||
|
||||
if (cam == null)
|
||||
{
|
||||
cam = FindObjectOfType<Camera>();
|
||||
}
|
||||
|
||||
if (cam == null)
|
||||
{
|
||||
EditorUtility.DisplayDialog("OOPS!", "Could not find a camera. Please add a camera to your scene.", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for Player
|
||||
GameObject plr = GameObject.Find("Player");
|
||||
|
||||
if (plr == null)
|
||||
{
|
||||
plr = GameObject.FindWithTag("Player");
|
||||
}
|
||||
|
||||
if (plr == null)
|
||||
{
|
||||
plr = cam.gameObject;
|
||||
}
|
||||
|
||||
// Check if there already is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance != null)
|
||||
{
|
||||
//Add and activate an instance
|
||||
EnviroSkyMgr.instance.CreateEnviroLWInstance();
|
||||
EnviroSkyMgr.instance.ActivateLWInstance();
|
||||
// Assign and start Enviro!
|
||||
EnviroSkyMgr.instance.AssignAndStart(plr, cam);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject EnviroSkyPrefab = null;
|
||||
EnviroSkyPrefab = CreateManager ();
|
||||
|
||||
SetupScene(cam);
|
||||
|
||||
//Add and activate an instance
|
||||
EnviroSkyMgr.instance.CreateEnviroLWInstance();
|
||||
EnviroSkyMgr.instance.ActivateLWInstance();
|
||||
// Assign and start Enviro!
|
||||
EnviroSkyMgr.instance.AssignAndStart(plr, cam);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
private static GameObject CreateManager ()
|
||||
{
|
||||
GameObject mgr = new GameObject();
|
||||
mgr.name = "Enviro Sky Manager for GAIA";
|
||||
mgr.AddComponent<EnviroSkyMgr>();
|
||||
mgr.AddComponent<EnviroEvents>();
|
||||
return mgr;
|
||||
}
|
||||
|
||||
|
||||
private static void SetupScene (Camera cam)
|
||||
{
|
||||
// Deactivate Wind Zones
|
||||
WindZone[] wz = GameObject.FindObjectsOfType<WindZone>();
|
||||
|
||||
for (int i = 0; i < wz.Length; i++)
|
||||
{
|
||||
wz[i].gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Deactivate Directional Lights
|
||||
Light[] lights = GameObject.FindObjectsOfType<Light>();
|
||||
for (int i = 0; i < lights.Length; i++)
|
||||
{
|
||||
if (lights[i].type == LightType.Directional)
|
||||
lights[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
#if AQUAS_PRESENT
|
||||
/// <summary>
|
||||
/// Add the AQUAS Integration Component
|
||||
/// </summary>
|
||||
public static void GX_AddAquasIntegration()
|
||||
{
|
||||
/*
|
||||
// Check if there is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
EditorUtility.DisplayDialog("OOPS!", "Please add Enviro Sky Manager first!", "OK");
|
||||
return;
|
||||
}
|
||||
GameObject AQUAS = null;
|
||||
// Find AQUAS Waterplane
|
||||
AQUAS = GameObject.Find ("AQUAS Waterplane");
|
||||
|
||||
if(AQUAS == null)
|
||||
AQUAS = GameObject.Find ("AQUASWater");
|
||||
|
||||
if (AQUAS == null) {
|
||||
EditorUtility.DisplayDialog ("OOPS!", "Could not find AQUAS Water in your scene. Please make sure that it is named: 'AQUAS Waterplane' or 'AQUASWater'.", "OK");
|
||||
return;
|
||||
} else {
|
||||
if (AQUAS.GetComponent<EnviroAquasIntegration> () != null) {
|
||||
EditorUtility.DisplayDialog ("OOPS!", "Aquas Integration already added!", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the component and assign waterObject
|
||||
EnviroAquasIntegration aquasIntegration = AQUAS.AddComponent<EnviroAquasIntegration> ();
|
||||
aquasIntegration.waterObject = AQUAS;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Set Enviro time of day to 6:00
|
||||
/// </summary>
|
||||
public static void GX_SetToMorning()
|
||||
{
|
||||
// Check if there is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
EditorUtility.DisplayDialog("OOPS!", "Please add Enviro Sky first!", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(6f);
|
||||
EnviroSkyMgr.instance.ReInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Enviro time of day to 12:00
|
||||
/// </summary>
|
||||
public static void GX_SetToNoon()
|
||||
{
|
||||
// Check if there is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
EditorUtility.DisplayDialog("OOPS!", "Please add Enviro Sky first!", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(12f);
|
||||
EnviroSkyMgr.instance.ReInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Enviro time of day to 17:00
|
||||
/// </summary>
|
||||
public static void GX_SetToEvening()
|
||||
{
|
||||
// Check if there is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
EditorUtility.DisplayDialog("OOPS!", "Please add Enviro Sky first!", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(17f);
|
||||
EnviroSkyMgr.instance.ReInit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Enviro time of day to 0:00
|
||||
/// </summary>
|
||||
public static void GX_SetToNight()
|
||||
{
|
||||
// Check if there is an instance of EnviroSky.
|
||||
if (EnviroSkyMgr.instance == null) {
|
||||
EditorUtility.DisplayDialog("OOPS!", "Please add Enviro Sky first!", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(0f);
|
||||
EnviroSkyMgr.instance.ReInit();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper methods
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset path of the first thing that matches the name
|
||||
/// </summary>
|
||||
/// <param name="name">Name to search for</param>
|
||||
/// <returns></returns>
|
||||
private static string GetAssetPath(string name)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
string[] assets = AssetDatabase.FindAssets(name, null);
|
||||
if (assets.Length > 0)
|
||||
{
|
||||
return AssetDatabase.GUIDToAssetPath(assets[0]);
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset prefab if we can find it in the project
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static GameObject GetAssetPrefab(string name)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
string[] assets = AssetDatabase.FindAssets(name, null);
|
||||
for (int idx = 0; idx < assets.Length; idx++)
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(assets[idx]);
|
||||
if (path.Contains(".prefab"))
|
||||
{
|
||||
return AssetDatabase.LoadAssetAtPath<GameObject>(path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the range from the terrain or return a default range if no terrain
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static float GetRangeFromTerrain()
|
||||
{
|
||||
Terrain terrain = GetActiveTerrain();
|
||||
if (terrain != null)
|
||||
{
|
||||
return Mathf.Max(terrain.terrainData.size.x, terrain.terrainData.size.z) / 2f;
|
||||
}
|
||||
return 1024f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the currently active terrain - or any terrain
|
||||
/// </summary>
|
||||
/// <returns>A terrain if there is one</returns>
|
||||
public static Terrain GetActiveTerrain()
|
||||
{
|
||||
//Grab active terrain if we can
|
||||
Terrain terrain = Terrain.activeTerrain;
|
||||
if (terrain != null && terrain.isActiveAndEnabled)
|
||||
{
|
||||
return terrain;
|
||||
}
|
||||
|
||||
//Then check rest of terrains
|
||||
for (int idx = 0; idx < Terrain.activeTerrains.Length; idx++)
|
||||
{
|
||||
terrain = Terrain.activeTerrains[idx];
|
||||
if (terrain != null && terrain.isActiveAndEnabled)
|
||||
{
|
||||
return terrain;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94cb3e92ea204e548a1ad3d128ded71d
|
||||
timeCreated: 1488948174
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a6eebf638dd5754483f09457e1a4c96
|
||||
folderAsset: yes
|
||||
timeCreated: 1582633794
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if ENVIRO_GLOBALSNOW_SUPPORT
|
||||
using GlobalSnowEffect;
|
||||
#endif
|
||||
[AddComponentMenu("Enviro/Integration/Global Snow")]
|
||||
public class GlobalSnowIntegration : MonoBehaviour
|
||||
{
|
||||
#if ENVIRO_GLOBALSNOW_SUPPORT
|
||||
public float snowIntensityMult = 1f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(GlobalSnow.instance != null)
|
||||
GlobalSnow.instance.snowAmount = Mathf.Clamp(EnviroSkyMgr.instance.GetSnowIntensity() * snowIntensityMult, 0f,2f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1477fecdcff172649a38dd05d846ad90
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60c8df07dd321ab4094535bae23cc3a7
|
||||
folderAsset: yes
|
||||
timeCreated: 1472528780
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
#if ENVIRO_LUX_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/LUX")]
|
||||
#endif
|
||||
public class EnviroLUXIntegration : MonoBehaviour
|
||||
{
|
||||
#if ENVIRO_LUX_SUPPORT
|
||||
public LuxDynamicWeather LuxDynamicWeatherScript;
|
||||
|
||||
private float curWetness = 0f;
|
||||
private float curSnow = 0f;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (LuxDynamicWeatherScript != null)
|
||||
{
|
||||
LuxDynamicWeatherScript.ScriptControlledWeather = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LuxDynamicWeatherScript = FindObjectOfType<LuxDynamicWeather>();
|
||||
|
||||
if (LuxDynamicWeatherScript != null)
|
||||
{
|
||||
LuxDynamicWeatherScript.ScriptControlledWeather = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please setup dynamic weather for LUX!");
|
||||
this.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetParameters ()
|
||||
{
|
||||
curWetness = EnviroSkyMgr.instance.GetWetnessIntensity();
|
||||
curSnow = EnviroSkyMgr.instance.GetSnowIntensity();
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
GetParameters ();
|
||||
|
||||
if (curWetness >= curSnow)
|
||||
{
|
||||
if(curWetness > 0.05f)
|
||||
LuxDynamicWeatherScript.Rainfall = curWetness;
|
||||
else
|
||||
LuxDynamicWeatherScript.Rainfall = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curSnow > 0.05f)
|
||||
LuxDynamicWeatherScript.Rainfall = curSnow;
|
||||
else
|
||||
LuxDynamicWeatherScript.Rainfall = 0f;
|
||||
}
|
||||
|
||||
LuxDynamicWeatherScript.Temperature = EnviroSkyMgr.instance.Weather.currentTemperature;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 634880e3f42a2fd4a9ea673f5eef72fc
|
||||
timeCreated: 1535894627
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
@@ -0,0 +1 @@
|
||||
If you own a copy of "Lux Shader Framework" (https://www.assetstore.unity3d.com/en/#!/content/16000) you can synchronize weather with you Lux materials! Unip the archive and add the component on a random gameobject in your scene and assign your lux dynamic weather component in your scene.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b83e96e0de032c8488f4cde119e98d0f
|
||||
timeCreated: 1437323643
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc9d66e4c9a222a418d171754a47b564
|
||||
folderAsset: yes
|
||||
timeCreated: 1535893839
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
#if ENVIRO_MEGASPLAT_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/MegaSplat Integration")]
|
||||
#endif
|
||||
public class EnviroMegaSplatIntegration : MonoBehaviour {
|
||||
#if ENVIRO_MEGASPLAT_SUPPORT
|
||||
public MegaSplatTerrainManager MegaSplatTerrianMgr;
|
||||
private Material MegaSplatMaterial;
|
||||
|
||||
[Header("Synchronize Weather")]
|
||||
public bool UpdateWetness = true;
|
||||
public bool UpdateSnow = true;
|
||||
public bool UpdatePuddles = true;
|
||||
public bool UpdateRainRipples = true;
|
||||
|
||||
[Header("Puddle Settings")]
|
||||
[Range(0f,1f)]
|
||||
public float puddleStartWetness = 0.25f;
|
||||
|
||||
private Vector4 MegaSplatWetness;
|
||||
private float puddleBlend;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
|
||||
if (MegaSplatTerrianMgr == null)
|
||||
MegaSplatTerrianMgr = GameObject.FindObjectOfType<MegaSplatTerrainManager>();
|
||||
|
||||
if (MegaSplatTerrianMgr != null)
|
||||
MegaSplatMaterial = MegaSplatTerrianMgr.templateMaterial;
|
||||
|
||||
if (MegaSplatMaterial != null)
|
||||
MegaSplatWetness = MegaSplatMaterial.GetVector ("_GlobalPorosityWetness");
|
||||
}
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (MegaSplatTerrianMgr == null || MegaSplatMaterial == null || EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (UpdateSnow){
|
||||
MegaSplatMaterial.SetFloat ("_SnowAmount", EnviroSkyMgr.instance.GetSnowIntensity());
|
||||
}
|
||||
|
||||
if (UpdateWetness) {
|
||||
MegaSplatMaterial.SetVector ("_GlobalPorosityWetness", new Vector4(MegaSplatWetness.x,EnviroSkyMgr.instance.GetWetnessIntensity(),MegaSplatWetness.z,MegaSplatWetness.w));
|
||||
}
|
||||
|
||||
if (UpdatePuddles) {
|
||||
puddleBlend = Mathf.Clamp(EnviroSkyMgr.instance.GetWetnessIntensity() - puddleStartWetness, 0f,1f) * 60f;
|
||||
puddleBlend = Mathf.Clamp (puddleBlend, 1f, 60f);
|
||||
MegaSplatMaterial.SetFloat ("_PuddleBlend",puddleBlend);
|
||||
}
|
||||
|
||||
if (UpdateRainRipples) {
|
||||
MegaSplatMaterial.SetFloat("_RainIntensity", EnviroSkyMgr.instance.GetWetnessIntensity());
|
||||
}
|
||||
|
||||
MegaSplatTerrianMgr.Sync();
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96ff090ac902fc54a9631bac1e42d597
|
||||
timeCreated: 1535589970
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
@@ -0,0 +1 @@
|
||||
If you own a copy of "MegaSplat" (https://www.assetstore.unity3d.com/en/#!/content/76166) you can synchronize weather with you MegaSplat materials! Add the component on a random gameobject in your scene and assign you MegaSplat material.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80d57295e11f3434ba69281dc2b8d2d9
|
||||
timeCreated: 1437323643
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b1395244e0c9c9439435c53ff4ad978
|
||||
folderAsset: yes
|
||||
timeCreated: 1535891598
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
#if ENVIRO_MICROSPLAT_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/MicroSplat Integration")]
|
||||
#endif
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class EnviroMicroSplatIntegration : MonoBehaviour {
|
||||
#if ENVIRO_MICROSPLAT_SUPPORT
|
||||
[Header("Wetness")]
|
||||
public bool UpdateWetness = true;
|
||||
[Range(0f, 1f)]
|
||||
public float maxWetness = 1f;
|
||||
[Header("Rain Ripples")]
|
||||
public bool UpdateRainRipples = true;
|
||||
[Header("Puddle Settings")]
|
||||
public bool UpdatePuddles = true;
|
||||
[Header("Stream Settings")]
|
||||
public bool UpdateStreams = true;
|
||||
[Header("Snow Settings")]
|
||||
public bool UpdateSnow = true;
|
||||
[Header("Wind Settings")]
|
||||
public bool UpdateWindStrength = true;
|
||||
public bool UpdateWindRotation = true;
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (UpdateSnow){
|
||||
Shader.SetGlobalFloat ("_Global_SnowLevel", EnviroSkyMgr.instance.GetSnowIntensity());
|
||||
}
|
||||
|
||||
if (UpdateWetness) {
|
||||
Shader.SetGlobalVector ("_Global_WetnessParams", new Vector2(EnviroSkyMgr.instance.GetWetnessIntensity(), maxWetness));
|
||||
}
|
||||
|
||||
if (UpdatePuddles) {
|
||||
Shader.SetGlobalFloat("_Global_PuddleParams", EnviroSkyMgr.instance.GetWetnessIntensity());
|
||||
}
|
||||
|
||||
if (UpdateRainRipples) {
|
||||
Shader.SetGlobalFloat("_Global_RainIntensity", EnviroSkyMgr.instance.GetWetnessIntensity());
|
||||
}
|
||||
|
||||
if (UpdateStreams) {
|
||||
Shader.SetGlobalFloat("_Global_StreamMax", EnviroSkyMgr.instance.GetWetnessIntensity());
|
||||
}
|
||||
//Sync all MicroSplat Values
|
||||
//MicroSplatTerrain.SyncAll();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4932f3bdd0952c4fa641693189de1ec
|
||||
timeCreated: 1535588191
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
If you are using Microsplat (https://www.assetstore.unity3d.com/en/#!/content/96478) as you terrain shader and using some of the advanced modules like Dynamic Snow or Wetness/Streams/Puddles you can synchronze these with enviro weather system.
|
||||
|
||||
1. Add the Enviro MicroSplat component to one of your gameobjects in scene.
|
||||
2. Enable modules in MicroSplat material editor.
|
||||
3. Enable the "Global Driven Property" in each module of Microsplat by clicking on the "G" next to the setting. For example at Snow Modules -> Amount.
|
||||
4. That's all! :)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c338c8565a0821246ab870611242f3ce
|
||||
timeCreated: 1525101331
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac6b058f3bb2ee34d88f09a503d97360
|
||||
folderAsset: yes
|
||||
timeCreated: 1547489816
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/// <summary>
|
||||
/// This component can be used to synchronize time and weather in games where server is a player too.
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
using Mirror;
|
||||
#endif
|
||||
using System.Collections;
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/Mirror Player")]
|
||||
[RequireComponent(typeof (NetworkIdentity))]
|
||||
public class EnviroMirrorPlayer : NetworkBehaviour {
|
||||
#else
|
||||
public class EnviroMirrorPlayer : MonoBehaviour {
|
||||
#endif
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
public bool assignOnStart = true;
|
||||
public bool findSceneCamera = true;
|
||||
|
||||
public GameObject Player;
|
||||
public Camera PlayerCamera;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// Deactivate if it isn't ours!
|
||||
if (!isLocalPlayer && !isServer) {
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerCamera == null && findSceneCamera)
|
||||
PlayerCamera = Camera.main;
|
||||
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
if (assignOnStart && Player != null && PlayerCamera != null)
|
||||
EnviroSkyMgr.instance.AssignAndStart (Player, PlayerCamera);
|
||||
|
||||
Cmd_RequestSeason ();
|
||||
Cmd_RequestCurrentWeather ();
|
||||
}
|
||||
}
|
||||
|
||||
[Command]
|
||||
void Cmd_RequestSeason ()
|
||||
{
|
||||
RpcRequestSeason((int)EnviroSkyMgr.instance.GetCurrentSeason());
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcRequestSeason (int season)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeSeason((EnviroSeasons.Seasons)season);
|
||||
}
|
||||
|
||||
[Command]
|
||||
void Cmd_RequestCurrentWeather ()
|
||||
{
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++)
|
||||
{
|
||||
for (int w = 0; w < EnviroSkyMgr.instance.Weather.WeatherPrefabs.Count; w++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.Weather.WeatherPrefabs[w] == EnviroSkyMgr.instance.Weather.zones[i].currentActiveZoneWeatherPrefab)
|
||||
RpcRequestCurrentWeather(w,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcRequestCurrentWeather (int weather, int zone)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeZoneWeather(zone, weather);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3867d7b0a6ed10744b4e2bc2c50195fe
|
||||
timeCreated: 1480502929
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/// <summary>
|
||||
/// This component can be used to synchronize time and weather.
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
using Mirror;
|
||||
#endif
|
||||
using System.Collections;
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/Mirror Server Component")]
|
||||
[RequireComponent(typeof (NetworkIdentity))]
|
||||
public class EnviroMirrorServer : NetworkBehaviour {
|
||||
#else
|
||||
public class EnviroMirrorServer : MonoBehaviour {
|
||||
#endif
|
||||
#if ENVIRO_MIRROR_SUPPORT
|
||||
public float updateSmoothing = 15f;
|
||||
|
||||
[SyncVar] private float networkHours;
|
||||
[SyncVar] private int networkDays;
|
||||
[SyncVar] private int networkYears;
|
||||
|
||||
public bool isHeadless = true;
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
if (isHeadless) {
|
||||
EnviroSkyMgr.instance.StartAsServer();
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetAutoWeatherUpdates(true);
|
||||
|
||||
EnviroSkyMgr.instance.OnSeasonChanged += (EnviroSeasons.Seasons season) => {
|
||||
SendSeasonToClient (season);
|
||||
};
|
||||
EnviroSkyMgr.instance.OnZoneWeatherChanged += (EnviroWeatherPreset type, EnviroZone zone) => {
|
||||
SendWeatherToClient (type, zone);
|
||||
};
|
||||
}
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
if (!isServer) {
|
||||
EnviroSkyMgr.instance.SetTimeProgress(EnviroTime.TimeProgressMode.None);
|
||||
EnviroSkyMgr.instance.SetAutoWeatherUpdates(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SendWeatherToClient (EnviroWeatherPreset w, EnviroZone z)
|
||||
{
|
||||
int zoneID = 0;
|
||||
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.GetZoneList().Count; i++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.GetZoneList()[i] == z)
|
||||
zoneID = i;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.GetCurrentWeatherPresetList().Count; i++) {
|
||||
|
||||
if (EnviroSkyMgr.instance.GetCurrentWeatherPresetList()[i] == w)
|
||||
RpcWeatherUpdate (i,zoneID);
|
||||
}
|
||||
}
|
||||
|
||||
void SendSeasonToClient (EnviroSeasons.Seasons s)
|
||||
{
|
||||
RpcSeasonUpdate((int)s);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcSeasonUpdate (int season)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeSeason((EnviroSeasons.Seasons)season);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcWeatherUpdate (int weather, int zone)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeZoneWeather(zone, weather);
|
||||
}
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (!isServer)
|
||||
{
|
||||
if (networkHours < 1f && EnviroSkyMgr.instance.GetUniversalTimeOfDay() > 23f)
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(networkHours);
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(Mathf.Lerp(EnviroSkyMgr.instance.GetUniversalTimeOfDay(), (float)networkHours, Time.deltaTime * updateSmoothing));
|
||||
EnviroSkyMgr.instance.SetYears(networkYears);
|
||||
EnviroSkyMgr.instance.SetDays(networkDays);
|
||||
|
||||
} else {
|
||||
networkHours = EnviroSkyMgr.instance.GetUniversalTimeOfDay();
|
||||
networkDays = EnviroSkyMgr.instance.GetCurrentDay();
|
||||
networkYears = EnviroSkyMgr.instance.GetCurrentYear();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1707a573e135db47b7f93de1bc0459c
|
||||
timeCreated: 1491610098
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a57e2175c8be81949a04c4726bd6e6cf
|
||||
folderAsset: yes
|
||||
timeCreated: 1498394522
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a7755f6c14b23a43b97b4fe4d83e702
|
||||
folderAsset: yes
|
||||
timeCreated: 1535894756
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
#if ENVIRO_PEGASUS_SUPPORT
|
||||
namespace Pegasus
|
||||
{
|
||||
[CustomEditor(typeof(TriggerControlEnviro))]
|
||||
public class HeliosFadeEnviroEditor : Editor
|
||||
{
|
||||
GUIStyle m_boxStyle;
|
||||
GUIStyle m_wrapStyle;
|
||||
TriggerControlEnviro m_trigger;
|
||||
List<EnviroWeatherPreset> m_zoneWeatheraPrefabs = new List<EnviroWeatherPreset>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This is called when we select the poi in the editor
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_trigger = (TriggerControlEnviro)target;
|
||||
|
||||
if (m_trigger.m_enviroSky == null)
|
||||
{
|
||||
m_trigger.m_enviroSky = GameObject.FindObjectOfType<EnviroSkyMgr>();
|
||||
}
|
||||
|
||||
if (m_trigger.m_enviroSky != null)
|
||||
{
|
||||
EnviroZone zone = m_trigger.m_enviroSky.gameObject.GetComponent<EnviroZone>();
|
||||
if (zone != null)
|
||||
{
|
||||
m_zoneWeatheraPrefabs = zone.zoneWeatherPresets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the gui
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//Get our trigger
|
||||
m_trigger = (TriggerControlEnviro)target;
|
||||
|
||||
//Set up the box style
|
||||
if (m_boxStyle == null)
|
||||
{
|
||||
m_boxStyle = new GUIStyle(GUI.skin.box);
|
||||
m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
m_boxStyle.fontStyle = FontStyle.Bold;
|
||||
m_boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
//Setup the wrap style
|
||||
if (m_wrapStyle == null)
|
||||
{
|
||||
m_wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
m_wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
//Create a nice text intro
|
||||
GUILayout.BeginVertical("Enviro Weather Trigger", m_boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("This trigger controls Enviro time and weather settings.", m_wrapStyle);
|
||||
GUILayout.EndVertical();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
if (m_trigger.m_enviroSky == null)
|
||||
{
|
||||
EditorGUILayout.LabelField("Enviro Sky is missing from scene!!");
|
||||
}
|
||||
|
||||
bool controlTime = EditorGUILayout.Toggle("Control Time", m_trigger.m_controlTime);
|
||||
float startTime = m_trigger.m_startTime;
|
||||
float endTime = m_trigger.m_endTime;
|
||||
|
||||
if (controlTime)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.LabelField(string.Format("{0:00}:{1:00} - {2:00}:{3:00}", Mathf.FloorToInt(startTime), (startTime % 1.0f) * 60f, Mathf.FloorToInt(endTime), (endTime % 1.0f) * 60f));
|
||||
startTime = EditorGUILayout.Slider(GetLabel("Start Time"), startTime, 0f, 23.99f);
|
||||
endTime = EditorGUILayout.Slider(GetLabel("End Time"), endTime, 0f, 23.99f);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
bool controlWeather = EditorGUILayout.Toggle("Control Weather", m_trigger.m_controlWeather);
|
||||
int weatherID = m_trigger.m_weatherID;
|
||||
float weatherTransitionTime = m_trigger.m_weatherTransitionTime;
|
||||
|
||||
if (controlWeather)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
if (m_zoneWeatheraPrefabs.Count > 0)
|
||||
{
|
||||
GUIContent[] zonePrefabs = new GUIContent[m_zoneWeatheraPrefabs.Count];
|
||||
for (int idx = 0; idx < zonePrefabs.Length; idx++)
|
||||
{
|
||||
zonePrefabs[idx] = new GUIContent(m_zoneWeatheraPrefabs[idx].Name);
|
||||
}
|
||||
weatherID = EditorGUILayout.Popup(GetLabel("Weather"), weatherID, zonePrefabs);
|
||||
}
|
||||
else
|
||||
{
|
||||
weatherID = EditorGUILayout.IntField("Weather ID", weatherID);
|
||||
}
|
||||
weatherTransitionTime = EditorGUILayout.FloatField("Transition Time", weatherTransitionTime);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
//Check for changes, make undo record, make changes and let editor know we are dirty
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(m_trigger, "Made trigger changes");
|
||||
|
||||
m_trigger.m_triggerAtStart = controlTime || controlWeather;
|
||||
m_trigger.m_triggerOnUpdate = controlTime;
|
||||
m_trigger.m_triggerAtEnd = false;
|
||||
|
||||
m_trigger.m_controlTime = controlTime;
|
||||
m_trigger.m_startTime = startTime;
|
||||
m_trigger.m_endTime = endTime;
|
||||
|
||||
m_trigger.m_controlWeather = controlWeather;
|
||||
m_trigger.m_weatherID = weatherID;
|
||||
m_trigger.m_weatherTransitionTime = weatherTransitionTime;
|
||||
|
||||
//Mark it as dirty
|
||||
EditorUtility.SetDirty(m_trigger);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a content label - look the tooltip up if possible
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
private GUIContent GetLabel(string name)
|
||||
{
|
||||
string tooltip = "";
|
||||
if (m_tooltips.TryGetValue(name, out tooltip))
|
||||
{
|
||||
return new GUIContent(name, tooltip);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GUIContent(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The tooltips
|
||||
/// </summary>
|
||||
private static Dictionary<string, string> m_tooltips = new Dictionary<string, string>
|
||||
{
|
||||
{ "Min Height From", "Used to control how poi, lookat target and flythrough path heights are constrained. Manager - use the managers settings, collision - use whatever it collides with, terrain - use the terrain height, none - don't constrain." },
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 315cf55edd2b07444818a16f64602e15
|
||||
timeCreated: 1498870879
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
#if ENVIRO_PEGASUS_SUPPORT
|
||||
namespace Pegasus
|
||||
{
|
||||
/// <summary>
|
||||
/// Control the weather in Enviro from Pegasus
|
||||
/// </summary>
|
||||
public class TriggerControlEnviro : TriggerBase
|
||||
{
|
||||
public EnviroSkyMgr m_enviroSky;
|
||||
|
||||
public bool m_controlTime = false;
|
||||
public float m_startTime = 0f;
|
||||
public float m_endTime = 23.999f;
|
||||
|
||||
public bool m_controlWeather = false;
|
||||
public int m_weatherID = 0;
|
||||
public float m_weatherTransitionTime = 10f; //Seconds
|
||||
|
||||
/// <summary>
|
||||
/// Called when the trigger starts
|
||||
/// </summary>
|
||||
/// <param name="poi"></param>
|
||||
public override void OnStart(PegasusPoi poi)
|
||||
{
|
||||
if (poi == null)
|
||||
{
|
||||
Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_enviroSky == null)
|
||||
{
|
||||
m_enviroSky = GameObject.FindObjectOfType<EnviroSkyMgr>();
|
||||
}
|
||||
|
||||
if (m_enviroSky == null)
|
||||
{
|
||||
Debug.LogWarning(string.Format("EnviroSky Manager was not located on {0} - exiting", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_controlTime)
|
||||
{
|
||||
m_enviroSky.SetTimeOfDay(m_startTime);
|
||||
}
|
||||
|
||||
if (m_controlWeather)
|
||||
{
|
||||
m_enviroSky.WeatherSettings.effectTransitionSpeed = m_weatherTransitionTime;
|
||||
m_enviroSky.ChangeWeather(m_weatherID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the trigger is updated
|
||||
/// </summary>
|
||||
/// <param name="poi"></param>
|
||||
public override void OnUpdate(PegasusPoi poi, float progress)
|
||||
{
|
||||
if (m_enviroSky == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_controlTime)
|
||||
{
|
||||
m_enviroSky.SetTimeOfDay(m_startTime + ((m_endTime - m_startTime) * progress));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0e8615ea69bf1f439e6ee27e0234c01
|
||||
timeCreated: 1535894756
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc7ec3a44b4c84a49aee84505266ee96
|
||||
folderAsset: yes
|
||||
timeCreated: 1546967413
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
using Photon.Pun;
|
||||
[RequireComponent(typeof (PhotonView))]
|
||||
[AddComponentMenu("Enviro/Integration/PhotonSynchronization")]
|
||||
#endif
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
public class EnviroPhotonIntegration : MonoBehaviourPunCallbacks, IPunObservable
|
||||
{
|
||||
#else
|
||||
public class EnviroPhotonIntegration : MonoBehaviour
|
||||
{
|
||||
|
||||
#endif
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
public ViewSynchronization synchronizationType = ViewSynchronization.Unreliable;
|
||||
public float updateSmoothing = 15f;
|
||||
private float networkHours;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
networkHours = EnviroSkyMgr.instance.GetUniversalTimeOfDay();
|
||||
photonView.ObservedComponents[0] = this;
|
||||
photonView.Synchronization = synchronizationType;
|
||||
}
|
||||
|
||||
public override void OnJoinedRoom()
|
||||
{
|
||||
if (PhotonNetwork.IsMasterClient)
|
||||
{
|
||||
EnviroSkyMgr.instance.Weather.updateWeather = true;
|
||||
EnviroSkyMgr.instance.OnZoneWeatherChanged += (EnviroWeatherPreset type, EnviroZone zone) => {
|
||||
SendWeatherToClient (type, zone);
|
||||
};
|
||||
|
||||
EnviroSkyMgr.instance.OnSeasonChanged += (EnviroSeasons.Seasons season) => {
|
||||
SendSeasonToClient (season);
|
||||
};
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
EnviroSkyMgr.instance.Time.ProgressTime = EnviroTime.TimeProgressMode.None;
|
||||
EnviroSkyMgr.instance.Weather.updateWeather = false;
|
||||
EnviroSkyMgr.instance.Seasons.calcSeasons = false;
|
||||
StartCoroutine (GetWeather ());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator GetWeather ()
|
||||
{
|
||||
yield return 0;
|
||||
photonView.RPC("GetWeatherAndSeason", RpcTarget.MasterClient);
|
||||
}
|
||||
|
||||
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
|
||||
{
|
||||
if (stream.IsWriting)
|
||||
{
|
||||
stream.SendNext(EnviroSkyMgr.instance.GetTimeOfDay());
|
||||
stream.SendNext(EnviroSkyMgr.instance.GetCurrentDay());
|
||||
stream.SendNext(EnviroSkyMgr.instance.GetCurrentYear());
|
||||
}
|
||||
else
|
||||
{
|
||||
networkHours = (float) stream.ReceiveNext();
|
||||
EnviroSkyMgr.instance.Time.Days = (int) stream.ReceiveNext();
|
||||
EnviroSkyMgr.instance.Time.Years = (int) stream.ReceiveNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SendWeatherToClient (EnviroWeatherPreset type, EnviroZone zone)
|
||||
{
|
||||
int weatherID = 0;
|
||||
int zoneID = 0;
|
||||
|
||||
for(int i = 0; i < EnviroSkyMgr.instance.Weather.weatherPresets.Count; i++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.Weather.weatherPresets [i] == type)
|
||||
weatherID = i;
|
||||
}
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.Weather.zones [i] == zone)
|
||||
zoneID = i;
|
||||
}
|
||||
|
||||
photonView.RPC("SendWeatherUpdate", RpcTarget.OthersBuffered,weatherID,zoneID);
|
||||
}
|
||||
|
||||
void SendSeasonToClient (EnviroSeasons.Seasons s)
|
||||
{
|
||||
photonView.RPC("SendSeasonUpdate",RpcTarget.OthersBuffered,(int)s);
|
||||
}
|
||||
|
||||
[PunRPC]
|
||||
void GetWeatherAndSeason ()
|
||||
{
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++)
|
||||
{
|
||||
SendWeatherToClient(EnviroSkyMgr.instance.Weather.zones[i].currentActiveZoneWeatherPreset, EnviroSkyMgr.instance.Weather.zones[i]);
|
||||
}
|
||||
|
||||
SendSeasonToClient(EnviroSkyMgr.instance.Seasons.currentSeasons);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[PunRPC]
|
||||
void SendWeatherUpdate (int id, int zone)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeZoneWeather(zone, id);
|
||||
}
|
||||
|
||||
[PunRPC]
|
||||
void SendSeasonUpdate (int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
EnviroSkyMgr.instance.Seasons.currentSeasons = EnviroSeasons.Seasons.Spring;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
EnviroSkyMgr.instance.Seasons.currentSeasons = EnviroSeasons.Seasons.Summer;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
EnviroSkyMgr.instance.Seasons.currentSeasons = EnviroSeasons.Seasons.Autumn;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
EnviroSkyMgr.instance.Seasons.currentSeasons = EnviroSeasons.Seasons.Winter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Update ()
|
||||
{
|
||||
|
||||
if (EnviroSkyMgr.instance == null || !EnviroSkyMgr.instance.IsAvailable())
|
||||
return;
|
||||
|
||||
if (!PhotonNetwork.IsMasterClient)
|
||||
{
|
||||
if (networkHours < 0.5f && EnviroSkyMgr.instance.Time.Hours > 23f)
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(networkHours);
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(Mathf.Lerp (EnviroSkyMgr.instance.GetTimeOfDay(), (float)networkHours, Time.deltaTime * updateSmoothing));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7925687e4e8bc0d4a98f876669085bcd
|
||||
timeCreated: 1546965222
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
using Photon.Pun;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
[RequireComponent(typeof(PhotonView))]
|
||||
#endif
|
||||
public class EnviroPhotonPlayerAssign : MonoBehaviour {
|
||||
#if ENVIRO_PHOTON_SUPPORT
|
||||
public PhotonView myView;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if(myView == null)
|
||||
myView = GetComponent<PhotonView>();
|
||||
|
||||
if (myView.IsMine && EnviroSkyMgr.instance != null)
|
||||
{
|
||||
EnviroSkyMgr.instance.AssignAndStart(gameObject, Camera.main);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d6cae83f5be1b24fad13a54ed433c38
|
||||
timeCreated: 1546965222
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc07639857dfbfc49a3f85d3f25d36ae
|
||||
folderAsset: yes
|
||||
timeCreated: 1535894056
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////// EnviroRTP - Switches RTP Presets and grass color according current seasons //////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if ENVIRO_RTP_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/RTP")]
|
||||
#endif
|
||||
public class EnviroRTPIntegration : MonoBehaviour {
|
||||
#if ENVIRO_RTP_SUPPORT
|
||||
public Terrain terrain;
|
||||
public ReliefTerrain rtp;
|
||||
|
||||
public bool ChangeGrass = true;
|
||||
public bool ChangeGrassDensity = true;
|
||||
public bool ChangePresets = true;
|
||||
public bool ChangePresetsComplete = true;
|
||||
public bool UpdateWeatherOnTerrain = true;
|
||||
|
||||
public string RTPSpringPresetName;
|
||||
public string RTPSummerPresetName;
|
||||
public string RTPAutumnPresetName;
|
||||
public string RTPWinterPresetName;
|
||||
|
||||
public Color SpringGrassColor;
|
||||
public Color SummerGrassColor;
|
||||
public Color AutumnGrassColor;
|
||||
public Color WinterGrassColor;
|
||||
|
||||
public float SpringGrassDensity = 0.7f;
|
||||
public float SummerGrassDensity = 1f;
|
||||
public float AutumnGrassDensity = 1f;
|
||||
public float WinterGrassDensity = 0f;
|
||||
|
||||
private ReliefTerrainPresetHolder currentPreset;
|
||||
private ReliefTerrainPresetHolder springPreset;
|
||||
private ReliefTerrainPresetHolder summerPreset;
|
||||
private ReliefTerrainPresetHolder autumnPreset;
|
||||
private ReliefTerrainPresetHolder winterPreset;
|
||||
|
||||
// Use this for initialization
|
||||
void Start ()
|
||||
{
|
||||
if (terrain == null)
|
||||
terrain = GetComponent<Terrain> ();
|
||||
|
||||
|
||||
|
||||
if (ChangePresets)
|
||||
{
|
||||
springPreset = rtp.GetPresetByName(RTPSpringPresetName);
|
||||
summerPreset = rtp.GetPresetByName(RTPSummerPresetName);
|
||||
autumnPreset = rtp.GetPresetByName(RTPAutumnPresetName);
|
||||
winterPreset = rtp.GetPresetByName(RTPWinterPresetName);
|
||||
|
||||
switch (EnviroSkyMgr.instance.Seasons.currentSeasons)
|
||||
{
|
||||
case EnviroSeasons.Seasons.Spring:
|
||||
currentPreset = rtp.GetPresetByName(RTPSpringPresetName);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Summer:
|
||||
currentPreset = rtp.GetPresetByName(RTPSpringPresetName);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Autumn:
|
||||
currentPreset = rtp.GetPresetByName(RTPSpringPresetName);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Winter:
|
||||
currentPreset = rtp.GetPresetByName(RTPSpringPresetName);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UpdateSeason ();
|
||||
|
||||
EnviroSkyMgr.instance.OnSeasonChanged += (EnviroSeasons.Seasons season) =>
|
||||
{
|
||||
UpdateSeason ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Check for correct Setup
|
||||
void OnEnable ()
|
||||
{
|
||||
if (ChangePresets)
|
||||
{
|
||||
if(RTPSpringPresetName == null)
|
||||
{
|
||||
Debug.LogError("Please assign a spring preset in Inspector!");
|
||||
this.enabled = false;
|
||||
}
|
||||
if(RTPSummerPresetName == null)
|
||||
{
|
||||
Debug.LogError("Please assign a summer preset in Inspector!");
|
||||
this.enabled = false;
|
||||
}
|
||||
if(RTPAutumnPresetName == null)
|
||||
{
|
||||
Debug.LogError("Please assign a autumn preset in Inspector!");
|
||||
this.enabled = false;
|
||||
}
|
||||
if(RTPWinterPresetName == null)
|
||||
{
|
||||
Debug.LogError("Please assign a winter preset in Inspector!");
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeGrassColor (Color ChangeToColor)
|
||||
{
|
||||
terrain.terrainData.wavingGrassTint = ChangeToColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UpdateSeason ()
|
||||
{
|
||||
switch (EnviroSkyMgr.instance.Seasons.currentSeasons)
|
||||
{
|
||||
case EnviroSeasons.Seasons.Spring:
|
||||
|
||||
if(ChangeGrass)
|
||||
ChangeGrassColor(SpringGrassColor);
|
||||
if(ChangeGrassDensity)
|
||||
terrain.detailObjectDensity = SpringGrassDensity;
|
||||
|
||||
if(ChangePresetsComplete)
|
||||
rtp.RestorePreset(springPreset);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Summer:
|
||||
|
||||
if(ChangeGrass)
|
||||
ChangeGrassColor(SummerGrassColor);
|
||||
if(ChangeGrassDensity)
|
||||
terrain.detailObjectDensity = SummerGrassDensity;
|
||||
|
||||
if(ChangePresetsComplete)
|
||||
rtp.RestorePreset(summerPreset);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Autumn:
|
||||
|
||||
if(ChangeGrass)
|
||||
ChangeGrassColor(AutumnGrassColor);
|
||||
if(ChangeGrassDensity)
|
||||
terrain.detailObjectDensity = AutumnGrassDensity;
|
||||
|
||||
if(ChangePresetsComplete)
|
||||
rtp.RestorePreset(autumnPreset);
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Winter:
|
||||
|
||||
if(ChangeGrass)
|
||||
ChangeGrassColor(WinterGrassColor);
|
||||
if(ChangeGrassDensity)
|
||||
terrain.detailObjectDensity = WinterGrassDensity;
|
||||
|
||||
if(ChangePresetsComplete)
|
||||
rtp.RestorePreset(winterPreset);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UpdateWeather ()
|
||||
{
|
||||
rtp.globalSettingsHolder._snow_strength = EnviroSkyMgr.instance.Weather.curSnowStrength;
|
||||
|
||||
if(EnviroSkyMgr.instance.Weather.wetness > 0f)
|
||||
{
|
||||
rtp.globalSettingsHolder.TERRAIN_GlobalWetness = EnviroSkyMgr.instance.Weather.curWetness;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtp.globalSettingsHolder.TERRAIN_GlobalWetness = 0f;
|
||||
}
|
||||
|
||||
rtp.globalSettingsHolder.Refresh(terrain.materialTemplate, rtp);
|
||||
}
|
||||
|
||||
void UpdateRTP ()
|
||||
{
|
||||
switch (EnviroSkyMgr.instance.Seasons.currentSeasons)
|
||||
{
|
||||
case EnviroSeasons.Seasons.Spring:
|
||||
rtp.InterpolatePresets(currentPreset.PresetID, springPreset.PresetID, 0.1f);
|
||||
currentPreset = springPreset;
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Summer:
|
||||
rtp.InterpolatePresets(currentPreset.PresetID, summerPreset.PresetID, 0.1f);
|
||||
currentPreset = summerPreset;
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Autumn:
|
||||
rtp.InterpolatePresets(currentPreset.PresetID, autumnPreset.PresetID, 0.1f);
|
||||
currentPreset = autumnPreset;
|
||||
break;
|
||||
|
||||
case EnviroSeasons.Seasons.Winter:
|
||||
rtp.InterpolatePresets(currentPreset.PresetID, winterPreset.PresetID, 0.1f);
|
||||
currentPreset = winterPreset;
|
||||
break;
|
||||
}
|
||||
rtp.globalSettingsHolder.Refresh();
|
||||
}
|
||||
|
||||
IEnumerator ChangeCurrentPreset (ReliefTerrainPresetHolder me)
|
||||
{
|
||||
yield return new WaitForSeconds (1f);
|
||||
currentPreset = me;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update ()
|
||||
{
|
||||
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (ChangePresets)
|
||||
UpdateRTP ();
|
||||
if (UpdateWeatherOnTerrain)
|
||||
UpdateWeather ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a47b7e2d3f146814caffbe2505547ab4
|
||||
timeCreated: 1535727667
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
If you own a copy of "Relief Terrain Shaders 3" (https://www.assetstore.unity3d.com/en/#!/content/5664) you can use the script in the RAR archive to integrate ENVIRO weather and season features with RTP!
|
||||
Just unpack and add the script to the Terrain with the Relief Terrain Manager script.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e14170a0f6bfa54481bf1e52bd73407
|
||||
timeCreated: 1437323643
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78f48672f7b7f8d45b5bbbc773a8f032
|
||||
folderAsset: yes
|
||||
timeCreated: 1535894181
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
#if ENVIRO_UBER_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/UBER")]
|
||||
#endif
|
||||
public class EnviroUBERIntegration : MonoBehaviour
|
||||
{
|
||||
#if ENVIRO_UBER_SUPPORT
|
||||
public UBER_GlobalParams UBER_Global_Parameters;
|
||||
|
||||
private float curWetness = 0f;
|
||||
private float curSnow = 0f;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (UBER_Global_Parameters != null)
|
||||
{
|
||||
UBER_Global_Parameters.Simulate = true;
|
||||
UBER_Global_Parameters.UseParticleSystem = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UBER_Global_Parameters = FindObjectOfType<UBER_GlobalParams>();
|
||||
|
||||
if (UBER_Global_Parameters != null)
|
||||
{
|
||||
UBER_Global_Parameters.Simulate = true;
|
||||
UBER_Global_Parameters.UseParticleSystem = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please setup dynamic weather for UBER!");
|
||||
this.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetParameters ()
|
||||
{
|
||||
curWetness = EnviroSkyMgr.instance.GetWetnessIntensity();
|
||||
curSnow = EnviroSkyMgr.instance.GetSnowIntensity();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
GetParameters ();
|
||||
|
||||
if (curWetness >= curSnow)
|
||||
{
|
||||
if(curWetness > 0.05f)
|
||||
UBER_Global_Parameters.fallIntensity = curWetness;
|
||||
else
|
||||
UBER_Global_Parameters.fallIntensity = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curSnow > 0.05f)
|
||||
UBER_Global_Parameters.fallIntensity = curSnow;
|
||||
else
|
||||
UBER_Global_Parameters.fallIntensity = 0f;
|
||||
}
|
||||
|
||||
UBER_Global_Parameters.temperature = EnviroSkyMgr.instance.Weather.currentTemperature;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f904ee42062d71a418b0c0612f6b0812
|
||||
timeCreated: 1535590164
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
If you own a copy of "UBER Shaders" (https://www.assetstore.unity3d.com/en/#!/content/39959) you can use the script in the RAR archive to synchronize enviro weather with your UBER materials!
|
||||
Just unpack and add the component to a random gameobject in your scene and assign the Global_Parameter component from UBER.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 362a4303edb78bf41a59d9fdcaa85a65
|
||||
timeCreated: 1437323643
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74d2467085674df4792d578d874c8536
|
||||
folderAsset: yes
|
||||
timeCreated: 1474356767
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/// <summary>
|
||||
/// This component can be used to synchronize time and weather in games where server is a player too.
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
using UnityEngine.Networking;
|
||||
#endif
|
||||
using System.Collections;
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/UNet Player")]
|
||||
[RequireComponent(typeof (NetworkIdentity))]
|
||||
public class EnviroUNetPlayer : NetworkBehaviour {
|
||||
#else
|
||||
public class EnviroUNetPlayer : MonoBehaviour {
|
||||
#endif
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
public bool assignOnStart = true;
|
||||
public bool findSceneCamera = true;
|
||||
|
||||
public GameObject Player;
|
||||
public Camera PlayerCamera;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// Deactivate if it isn't ours!
|
||||
if (!isLocalPlayer && !isServer) {
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerCamera == null && findSceneCamera)
|
||||
PlayerCamera = Camera.main;
|
||||
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
if (assignOnStart && Player != null && PlayerCamera != null)
|
||||
EnviroSkyMgr.instance.AssignAndStart (Player, PlayerCamera);
|
||||
|
||||
Cmd_RequestSeason ();
|
||||
Cmd_RequestCurrentWeather ();
|
||||
}
|
||||
}
|
||||
|
||||
[Command]
|
||||
void Cmd_RequestSeason ()
|
||||
{
|
||||
RpcRequestSeason((int)EnviroSkyMgr.instance.GetCurrentSeason());
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcRequestSeason (int season)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeSeason((EnviroSeasons.Seasons)season);
|
||||
}
|
||||
|
||||
[Command]
|
||||
void Cmd_RequestCurrentWeather ()
|
||||
{
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++)
|
||||
{
|
||||
for (int w = 0; w < EnviroSkyMgr.instance.Weather.WeatherPrefabs.Count; w++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.Weather.WeatherPrefabs[w] == EnviroSkyMgr.instance.Weather.zones[i].currentActiveZoneWeatherPrefab)
|
||||
RpcRequestCurrentWeather(w,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcRequestCurrentWeather (int weather, int zone)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeZoneWeather(zone, weather);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95944110ac51cf44d977c5c2627ac362
|
||||
timeCreated: 1480502929
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/// <summary>
|
||||
/// This component can be used to synchronize time and weather.
|
||||
/// </summary>
|
||||
|
||||
using UnityEngine;
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
using UnityEngine.Networking;
|
||||
#endif
|
||||
using System.Collections;
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
[AddComponentMenu("Enviro/Integration/UNet Server Component")]
|
||||
[RequireComponent(typeof (NetworkIdentity))]
|
||||
public class EnviroUNetServer : NetworkBehaviour {
|
||||
#else
|
||||
public class EnviroUNetServer : MonoBehaviour {
|
||||
#endif
|
||||
#if ENVIRO_UNET_SUPPORT
|
||||
public float updateSmoothing = 15f;
|
||||
|
||||
[SyncVar] private float networkHours;
|
||||
[SyncVar] private int networkDays;
|
||||
[SyncVar] private int networkYears;
|
||||
|
||||
public bool isHeadless = false;
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
if (isHeadless) {
|
||||
EnviroSkyMgr.instance.StartAsServer();
|
||||
}
|
||||
|
||||
EnviroSkyMgr.instance.SetAutoWeatherUpdates(true);
|
||||
|
||||
EnviroSkyMgr.instance.OnSeasonChanged += (EnviroSeasons.Seasons season) => {
|
||||
SendSeasonToClient (season);
|
||||
};
|
||||
EnviroSkyMgr.instance.OnZoneWeatherChanged += (EnviroWeatherPreset type, EnviroZone zone) => {
|
||||
SendWeatherToClient (type, zone);
|
||||
};
|
||||
}
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
|
||||
if (!isServer) {
|
||||
EnviroSkyMgr.instance.SetTimeProgress(EnviroTime.TimeProgressMode.None);
|
||||
EnviroSkyMgr.instance.SetAutoWeatherUpdates(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SendWeatherToClient (EnviroWeatherPreset w, EnviroZone z)
|
||||
{
|
||||
int zoneID = 0;
|
||||
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.GetZoneList().Count; i++)
|
||||
{
|
||||
if (EnviroSkyMgr.instance.GetZoneList()[i] == z)
|
||||
zoneID = i;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.GetCurrentWeatherPresetList().Count; i++) {
|
||||
|
||||
if (EnviroSkyMgr.instance.GetCurrentWeatherPresetList()[i] == w)
|
||||
RpcWeatherUpdate (i,zoneID);
|
||||
}
|
||||
}
|
||||
|
||||
void SendSeasonToClient (EnviroSeasons.Seasons s)
|
||||
{
|
||||
RpcSeasonUpdate((int)s);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcSeasonUpdate (int season)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeSeason((EnviroSeasons.Seasons)season);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcWeatherUpdate (int weather, int zone)
|
||||
{
|
||||
EnviroSkyMgr.instance.ChangeZoneWeather(zone, weather);
|
||||
}
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (!isServer)
|
||||
{
|
||||
if (networkHours < 1f && EnviroSkyMgr.instance.GetUniversalTimeOfDay() > 23f)
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(networkHours);
|
||||
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(Mathf.Lerp(EnviroSkyMgr.instance.GetUniversalTimeOfDay(), (float)networkHours, Time.deltaTime * updateSmoothing));
|
||||
EnviroSkyMgr.instance.SetYears(networkYears);
|
||||
EnviroSkyMgr.instance.SetDays(networkDays);
|
||||
|
||||
} else {
|
||||
networkHours = EnviroSkyMgr.instance.GetUniversalTimeOfDay();
|
||||
networkDays = EnviroSkyMgr.instance.GetCurrentDay();
|
||||
networkYears = EnviroSkyMgr.instance.GetCurrentYear();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e76527d89a1b908408bede482939128b
|
||||
timeCreated: 1491610098
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d958ab7fa195b0488732a701a96aced
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
// Vegetation Studio Pro Integration v0.2
|
||||
// Thanks to Meishin for optimizations!
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
using AwesomeTechnologies.VegetationSystem;
|
||||
using AwesomeTechnologies.VegetationStudio;
|
||||
#endif
|
||||
[AddComponentMenu("Enviro/Integration/VS Pro Integration")]
|
||||
public class EnviroVegetationStudioPro : MonoBehaviour
|
||||
{
|
||||
|
||||
#if VEGETATION_STUDIO_PRO
|
||||
private const float updatePrecision = 0.01f;
|
||||
public bool setWindZone = true;
|
||||
public bool syncRain = true;
|
||||
public bool syncSnow = true;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (VegetationStudioManager.Instance == null || EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (setWindZone)
|
||||
{
|
||||
for (int i = 0; i < VegetationStudioManager.Instance.VegetationSystemList.Count; i++)
|
||||
{
|
||||
VegetationStudioManager.Instance.VegetationSystemList[i].SelectedWindZone = EnviroSkyMgr.instance.Components.windZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(VegetationStudioManager.Instance == null || EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
//Update Vegetation Systems
|
||||
foreach(VegetationSystemPro vegetationSystem in VegetationStudioManager.Instance.VegetationSystemList)
|
||||
{
|
||||
if (!vegetationSystem.enabled)
|
||||
continue;
|
||||
|
||||
EnviroWeather Enviro = EnviroSkyMgr.instance.Weather;
|
||||
EnvironmentSettings VSPro = vegetationSystem.EnvironmentSettings;
|
||||
|
||||
// Should we refresh VSPro ?
|
||||
bool updateVSPro = false;
|
||||
|
||||
if (syncRain && Mathf.Abs(VSPro.RainAmount - Enviro.wetness) >= updatePrecision)
|
||||
updateVSPro = true;
|
||||
if (syncSnow && Mathf.Abs(VSPro.SnowAmount - Enviro.snowStrength) >= updatePrecision)
|
||||
updateVSPro = true;
|
||||
|
||||
if (syncRain && updateVSPro)
|
||||
VSPro.RainAmount = Enviro.wetness;
|
||||
|
||||
if (syncSnow && updateVSPro)
|
||||
VSPro.SnowAmount = Enviro.snowStrength;
|
||||
|
||||
if (updateVSPro)
|
||||
vegetationSystem.RefreshMaterials();
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 601815eb081877b43a09d52649c32188
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5cd2887e55d65944a74231a28a1cca7
|
||||
folderAsset: yes
|
||||
timeCreated: 1504230646
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64ea7661d53aca14c869dab565351aac
|
||||
folderAsset: yes
|
||||
timeCreated: 1504230665
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if WORLDAPI_PRESENT
|
||||
[CustomEditor(typeof(EnviroWorldAPIIntegration))]
|
||||
public class EnviroWAPIEditor : Editor {
|
||||
|
||||
private GUIStyle boxStyle;
|
||||
private GUIStyle wrapStyle;
|
||||
private GUIStyle headerStyle;
|
||||
|
||||
SerializedObject serializedObj;
|
||||
private EnviroWorldAPIIntegration myTarget;
|
||||
|
||||
SerializedProperty snowPower, wetnessPower, fogPower, fogPowerMult, windDirection, windSpeed, seasons, time, cloudCover, location, temperature;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroWorldAPIIntegration)target;
|
||||
serializedObj = new SerializedObject (myTarget);
|
||||
snowPower = serializedObj.FindProperty ("snowPower");
|
||||
wetnessPower = serializedObj.FindProperty ("wetnessPower");
|
||||
temperature = serializedObj.FindProperty("temperature");
|
||||
fogPower = serializedObj.FindProperty ("fogPower");
|
||||
fogPowerMult = serializedObj.FindProperty ("fogPowerMult");
|
||||
windDirection = serializedObj.FindProperty ("windDirection");
|
||||
windSpeed = serializedObj.FindProperty ("windSpeed");
|
||||
seasons = serializedObj.FindProperty ("seasons");
|
||||
time = serializedObj.FindProperty ("time");
|
||||
cloudCover = serializedObj.FindProperty ("cloudCover");
|
||||
location = serializedObj.FindProperty ("location");
|
||||
}
|
||||
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
if (boxStyle == null)
|
||||
{
|
||||
boxStyle = new GUIStyle(GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Normal;
|
||||
wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
if (headerStyle == null)
|
||||
{
|
||||
headerStyle = new GUIStyle(GUI.skin.label);
|
||||
headerStyle.fontStyle = FontStyle.Bold;
|
||||
headerStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
GUILayout.BeginVertical("Enviro - WAPI Integration", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("Welcome to the World Manager Integration for Enviro - Sky and Weather!", wrapStyle);
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Controls", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
GUILayout.BeginVertical("Time, Season and Location", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.PropertyField (time, true, null);
|
||||
EditorGUILayout.PropertyField (location, true, null);
|
||||
EditorGUILayout.PropertyField (seasons, true, null);
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Weather", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("Enviro will change weather when using GetFromWAPI mode here to match WAPI values!", wrapStyle);
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField (cloudCover, true, null);
|
||||
EditorGUILayout.PropertyField (snowPower, true, null);
|
||||
EditorGUILayout.PropertyField (wetnessPower, true, null);
|
||||
EditorGUILayout.PropertyField (temperature, true, null);
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label ("Wind",headerStyle);
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField (windSpeed, true, null);
|
||||
EditorGUILayout.PropertyField (windDirection, true, null);
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.Label ("Fog",headerStyle);
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField (fogPower, true, null);
|
||||
if(myTarget.fogPower == EnviroWorldAPIIntegration.GetSet.SendToWAPI)
|
||||
EditorGUILayout.PropertyField (fogPowerMult, true, null);
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.EndVertical ();
|
||||
if (EditorGUI.EndChangeCheck ()) {
|
||||
serializedObj.ApplyModifiedProperties ();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3303ded446710d479a10781956a5416
|
||||
timeCreated: 1504230849
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if WORLDAPI_PRESENT
|
||||
using WAPI;
|
||||
|
||||
[AddComponentMenu("Enviro/WAPI Integration")]
|
||||
[ExecuteInEditMode]
|
||||
#endif
|
||||
#if WORLDAPI_PRESENT
|
||||
public class EnviroWorldAPIIntegration : MonoBehaviour, IWorldApiChangeHandler
|
||||
{
|
||||
public enum GetSet
|
||||
{
|
||||
None,
|
||||
GetFromWAPI,
|
||||
SendToWAPI
|
||||
}
|
||||
|
||||
public enum Get
|
||||
{
|
||||
None,
|
||||
GetFromWAPI
|
||||
}
|
||||
|
||||
public enum Set
|
||||
{
|
||||
None,
|
||||
SendToWAPI
|
||||
}
|
||||
|
||||
// Controls
|
||||
public GetSet snowPower;
|
||||
public GetSet wetnessPower;
|
||||
public GetSet fogPower;
|
||||
public GetSet temperature;
|
||||
public float fogPowerMult = 1000f;
|
||||
public Set windDirection;
|
||||
public Set windSpeed;
|
||||
public GetSet seasons;
|
||||
public GetSet time;
|
||||
public GetSet cloudCover;
|
||||
public GetSet location;
|
||||
|
||||
// Privates
|
||||
private float daysInYear;
|
||||
private float timeOfDay;
|
||||
|
||||
private List<EnviroWeatherPreset> weatherPresets = new List<EnviroWeatherPreset>();
|
||||
private List<EnviroWeatherPreset> clearWeatherPresets = new List<EnviroWeatherPreset>();
|
||||
private List<EnviroWeatherPreset> cloudyWeatherPresets = new List<EnviroWeatherPreset>();
|
||||
private List<EnviroWeatherPreset> rainWeatherPresets = new List<EnviroWeatherPreset>();
|
||||
private List<EnviroWeatherPreset> snowWeatherPresets = new List<EnviroWeatherPreset>();
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
ConnectToWorldAPI();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
DisconnectFromWorldAPI();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
{
|
||||
Debug.LogWarning("EnviroSkyMgr not found! Please add EnviroSky Manager to your scene!");
|
||||
return;
|
||||
}
|
||||
|
||||
daysInYear = EnviroSkyMgr.instance.Time.DaysInYear;
|
||||
timeOfDay = EnviroSkyMgr.instance.GetUniversalTimeOfDay();
|
||||
|
||||
//Create Lists of weather presets
|
||||
for (int i = 0; i < EnviroSkyMgr.instance.GetZoneList()[0].zoneWeatherPresets.Count; i++) {
|
||||
weatherPresets.Add(EnviroSkyMgr.instance.GetZoneList()[0].zoneWeatherPresets[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < weatherPresets.Count; i++)
|
||||
{
|
||||
//Clear Weather List
|
||||
if (weatherPresets [i].cloudsConfig.coverage <= -0.5)
|
||||
clearWeatherPresets.Add (weatherPresets [i]);
|
||||
|
||||
//Cloudy Weather List
|
||||
if (weatherPresets [i].cloudsConfig.coverage >= -0.5) {
|
||||
if (weatherPresets [i].wetnessLevel == 0f && weatherPresets [i].snowLevel == 0f)
|
||||
cloudyWeatherPresets.Add (weatherPresets [i]);
|
||||
}
|
||||
|
||||
// Rainy Weather List
|
||||
if (weatherPresets [i].wetnessLevel > 0f)
|
||||
rainWeatherPresets.Add (weatherPresets [i]);
|
||||
//Snowy Weather List
|
||||
if (weatherPresets [i].snowLevel > 0f)
|
||||
snowWeatherPresets.Add (weatherPresets [i]);
|
||||
}
|
||||
|
||||
ConnectToWorldAPI();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null)
|
||||
return;
|
||||
|
||||
if (EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset != null) {
|
||||
if (snowPower == GetSet.SendToWAPI) {
|
||||
WorldManager.Instance.Snow = new Vector4 (EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.snowLevel, EnviroSkyMgr.instance.Weather.curSnowStrength, WorldManager.Instance.SnowMinHeight, WorldManager.Instance.SnowAge);
|
||||
}
|
||||
|
||||
if (wetnessPower == GetSet.SendToWAPI) {
|
||||
WorldManager.Instance.Rain = new Vector4 (EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.wetnessLevel, EnviroSkyMgr.instance.Weather.curWetness, WorldManager.Instance.RainMinHeight, WorldManager.Instance.RainMaxHeight);
|
||||
}
|
||||
|
||||
if (fogPower == GetSet.SendToWAPI) {
|
||||
WorldManager.Instance.Fog = new Vector4 (EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.heightFogDensity * 0.1f, EnviroSkyMgr.instance.FogSettings.height, Mathf.Clamp01 (RenderSettings.fogDensity * fogPowerMult), WorldManager.Instance.FogDistanceMax);
|
||||
}
|
||||
}
|
||||
if (windDirection == Set.SendToWAPI) {
|
||||
if (EnviroSkyMgr.instance.CloudSettings.useWindZoneDirection)
|
||||
WorldManager.Instance.WindDirection = EnviroSkyMgr.instance.Components.windZone.transform.eulerAngles.y;
|
||||
}
|
||||
|
||||
if (windSpeed == Set.SendToWAPI) {
|
||||
WorldManager.Instance.WindSpeed = EnviroSkyMgr.instance.Components.windZone.windMain;
|
||||
}
|
||||
|
||||
if (seasons == GetSet.SendToWAPI)
|
||||
{
|
||||
WorldManager.Instance.Season = Mathf.Lerp(0f, 4f, EnviroSkyMgr.instance.Time.Days/daysInYear);
|
||||
}
|
||||
|
||||
if (time == GetSet.SendToWAPI)
|
||||
{
|
||||
timeOfDay = EnviroSkyMgr.instance.GetUniversalTimeOfDay();
|
||||
WorldManager.Instance.SetDecimalTime(timeOfDay);
|
||||
}
|
||||
|
||||
if (temperature == GetSet.SendToWAPI)
|
||||
{
|
||||
WorldManager.Instance.Temperature = EnviroSkyMgr.instance.Weather.currentTemperature;
|
||||
}
|
||||
|
||||
if (location == GetSet.SendToWAPI)
|
||||
{
|
||||
WorldManager.Instance.Latitude = EnviroSkyMgr.instance.Time.Latitude;
|
||||
WorldManager.Instance.Longitude = EnviroSkyMgr.instance.Time.Longitude;
|
||||
}
|
||||
|
||||
if (cloudCover == GetSet.SendToWAPI)
|
||||
{
|
||||
WorldManager.Instance.CloudPower = Mathf.Clamp01(EnviroSkyMgr.instance.Clouds.coverage * EnviroSkyMgr.instance.CloudSettings.globalCloudCoverage);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectToWorldAPI()
|
||||
{
|
||||
WorldManager.Instance.AddListener(this);
|
||||
}
|
||||
|
||||
void DisconnectFromWorldAPI()
|
||||
{
|
||||
WorldManager.Instance.RemoveListener(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle updates from world manager
|
||||
/// </summary>
|
||||
/// <param name="changeArgs">Change to time of day</param>
|
||||
public void OnWorldChanged(WorldChangeArgs changeArgs)
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null || !EnviroSkyMgr.instance.IsAvailable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Time from WAPI
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.GameTimeChanged) && time == GetSet.GetFromWAPI)
|
||||
{
|
||||
float newTimeOfDay = (float) changeArgs.manager.GetTimeDecimal();
|
||||
if (newTimeOfDay != timeOfDay)
|
||||
{
|
||||
timeOfDay = newTimeOfDay;
|
||||
EnviroSkyMgr.instance.SetTimeOfDay(timeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
//Get Season from WAPI
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.SeasonChanged) && seasons == GetSet.GetFromWAPI)
|
||||
{
|
||||
if (WorldManager.Instance.Season < 1f)
|
||||
EnviroSkyMgr.instance.ChangeSeason(EnviroSeasons.Seasons.Winter);
|
||||
else if (WorldManager.Instance.Season < 2f)
|
||||
EnviroSkyMgr.instance.ChangeSeason(EnviroSeasons.Seasons.Spring);
|
||||
else if (WorldManager.Instance.Season < 3f)
|
||||
EnviroSkyMgr.instance.ChangeSeason(EnviroSeasons.Seasons.Summer);
|
||||
else
|
||||
EnviroSkyMgr.instance.ChangeSeason(EnviroSeasons.Seasons.Autumn);
|
||||
}
|
||||
|
||||
// Set Lat/Lng from WAPI
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.LatLngChanged) && location == GetSet.GetFromWAPI)
|
||||
{
|
||||
EnviroSkyMgr.instance.Time.Latitude = WorldManager.Instance.Latitude;
|
||||
EnviroSkyMgr.instance.Time.Longitude = WorldManager.Instance.Longitude;
|
||||
}
|
||||
|
||||
// Set Distance and Height Fog from WAPI
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.FogChanged) && fogPower == GetSet.GetFromWAPI)
|
||||
{
|
||||
EnviroSkyMgr.instance.FogSettings.distanceFogIntensity = WorldManager.Instance.FogDistancePower * 10f;
|
||||
EnviroSkyMgr.instance.FogSettings.heightFogIntensity = WorldManager.Instance.FogHeightPower;
|
||||
EnviroSkyMgr.instance.FogSettings.height = WorldManager.Instance.FogHeightMax;
|
||||
}
|
||||
|
||||
// Set temparaute from WAPI
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.TempAndHumidityChanged) && temperature == GetSet.GetFromWAPI)
|
||||
{
|
||||
EnviroSkyMgr.instance.Weather.currentTemperature = WorldManager.Instance.Temperature;
|
||||
}
|
||||
|
||||
// Change Weather Based on WAPI Rain and Snow
|
||||
if (Application.isPlaying && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset != null)
|
||||
{
|
||||
// Cloudy
|
||||
if (changeArgs.HasChanged(WorldConstants.WorldChangeEvents.CloudsChanged) && cloudCover == GetSet.GetFromWAPI){
|
||||
ChangeWeatherOnCloudCoverChanged ();
|
||||
}
|
||||
|
||||
//Rain
|
||||
if (changeArgs.HasChanged (WorldConstants.WorldChangeEvents.RainChanged) && wetnessPower == GetSet.GetFromWAPI) {
|
||||
ChangeWeatherOnRainChanged (WorldManager.Instance.RainPower,WorldManager.Instance.SnowPower);
|
||||
}
|
||||
|
||||
//Snow
|
||||
if (changeArgs.HasChanged (WorldConstants.WorldChangeEvents.SnowChanged) && snowPower == GetSet.GetFromWAPI) {
|
||||
ChangeWeatherOnSnowChanged (WorldManager.Instance.RainPower,WorldManager.Instance.SnowPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ChangeWeatherOnCloudCoverChanged()
|
||||
{
|
||||
if (WorldManager.Instance.RainPower > 0.01f)
|
||||
return;
|
||||
|
||||
if (WorldManager.Instance.SnowPower > 0.01f)
|
||||
return;
|
||||
|
||||
float cloudCover = WorldManager.Instance.CloudPower;
|
||||
|
||||
if (cloudCover <= 0.1f)
|
||||
{
|
||||
if (clearWeatherPresets.Count > 0 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != clearWeatherPresets[0].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(clearWeatherPresets[0].Name);
|
||||
|
||||
}
|
||||
else if (cloudCover > 0.1f && cloudCover <= 0.3f)
|
||||
{
|
||||
if (cloudyWeatherPresets.Count > 0 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != cloudyWeatherPresets[0].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(cloudyWeatherPresets[0].Name);
|
||||
|
||||
}
|
||||
else if (cloudCover > 0.3f && cloudCover <= 0.7f)
|
||||
{
|
||||
if (cloudyWeatherPresets.Count > 1 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != cloudyWeatherPresets[1].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(cloudyWeatherPresets[1].Name);
|
||||
|
||||
}
|
||||
else if (cloudCover > 0.7f)
|
||||
{
|
||||
if (cloudyWeatherPresets.Count > 2 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != cloudyWeatherPresets[2].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(cloudyWeatherPresets[2].Name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeWeatherOnRainChanged(float r, float s)
|
||||
{
|
||||
if (r < s || r == 0f)
|
||||
{
|
||||
if (s > 0)
|
||||
ChangeWeatherOnSnowChanged(r, s);
|
||||
else
|
||||
ChangeWeatherOnCloudCoverChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
float rainPower = r;
|
||||
|
||||
if (rainPower < 0.1f)
|
||||
{
|
||||
ChangeWeatherOnCloudCoverChanged();
|
||||
}
|
||||
else if (rainPower > 0.1f && rainPower <= 0.4f)
|
||||
{
|
||||
if (rainWeatherPresets.Count > 0 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != rainWeatherPresets[0].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(rainWeatherPresets[0].Name);
|
||||
|
||||
}
|
||||
else if (rainPower > 0.4f && rainPower < 0.7f)
|
||||
{
|
||||
if (rainWeatherPresets.Count > 1 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != rainWeatherPresets[1].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(rainWeatherPresets[1].Name);
|
||||
|
||||
}
|
||||
else if (rainPower > 0.7f)
|
||||
{
|
||||
if (rainWeatherPresets.Count > 2 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != rainWeatherPresets[2].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(rainWeatherPresets[2].Name);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeWeatherOnSnowChanged(float r, float s)
|
||||
{
|
||||
if (s < r || s == 0f)
|
||||
{
|
||||
if (r > 0)
|
||||
ChangeWeatherOnRainChanged(r, s);
|
||||
else
|
||||
ChangeWeatherOnCloudCoverChanged();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
float snowPower = s;
|
||||
|
||||
if (snowPower <= 0.1f)
|
||||
{
|
||||
ChangeWeatherOnCloudCoverChanged();
|
||||
}
|
||||
else if (snowPower > 0.1f && snowPower <= 0.5f)
|
||||
{
|
||||
if (snowWeatherPresets.Count > 0 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != snowWeatherPresets[0].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(snowWeatherPresets[0].Name);
|
||||
|
||||
}
|
||||
else if (snowPower > 0.5f)
|
||||
{
|
||||
if (snowWeatherPresets.Count > 1 && EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset.Name != snowWeatherPresets[1].Name)
|
||||
EnviroSkyMgr.instance.ChangeWeather(snowWeatherPresets[1].Name);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2be409978109ee42913a1078886e856
|
||||
timeCreated: 1503278604
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39d8d3f4fcf51ed46a1138e437d18add
|
||||
folderAsset: yes
|
||||
timeCreated: 1532146013
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,156 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
[CustomEditor(typeof(EnviroInterior))]
|
||||
public class EnviroInteriorEditor : Editor {
|
||||
|
||||
GUIStyle boxStyle;
|
||||
GUIStyle wrapStyle;
|
||||
GUIStyle headerStyle;
|
||||
EnviroInterior myTarget;
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroInterior)target;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
|
||||
myTarget = (EnviroInterior)target;
|
||||
|
||||
if (boxStyle == null) {
|
||||
boxStyle = new GUIStyle (GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Normal;
|
||||
wrapStyle.wordWrap = true;
|
||||
wrapStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (headerStyle == null)
|
||||
{
|
||||
headerStyle = new GUIStyle(GUI.skin.label);
|
||||
headerStyle.fontStyle = FontStyle.Bold;
|
||||
headerStyle.wordWrap = true;
|
||||
headerStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
|
||||
GUILayout.BeginVertical("Enviro - Interior Zone", boxStyle);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("Welcome to the Interior Zone for Enviro - Sky and Weather!", wrapStyle);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
GUILayout.BeginVertical("Setup", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.zoneTriggerType = (EnviroInterior.ZoneTriggerType)EditorGUILayout.EnumPopup("Zone Trigger Type", myTarget.zoneTriggerType);
|
||||
|
||||
if (GUILayout.Button ("Create New Trigger")) {
|
||||
myTarget.CreateNewTrigger ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < myTarget.triggers.Count; i++) {
|
||||
|
||||
if (myTarget.triggers[i] != null)
|
||||
{
|
||||
GUILayout.BeginVertical("", boxStyle);
|
||||
GUILayout.Space(10);
|
||||
myTarget.triggers[i].Name = EditorGUILayout.TextField("Name", myTarget.triggers[i].Name);
|
||||
GUILayout.Space(10);
|
||||
if (GUILayout.Button("Select"))
|
||||
{
|
||||
Selection.activeObject = myTarget.triggers[i].gameObject;
|
||||
}
|
||||
if (GUILayout.Button("Remove"))
|
||||
{
|
||||
myTarget.RemoveTrigger(myTarget.triggers[i]);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Lighting", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.directLighting = EditorGUILayout.BeginToggleGroup("Direct Light Modifications", myTarget.directLighting);
|
||||
myTarget.directLightingMod = EditorGUILayout.ColorField ("Direct Lighting Mod", myTarget.directLightingMod);
|
||||
myTarget.directLightFadeSpeed = EditorGUILayout.Slider("Direct Fading Speed", myTarget.directLightFadeSpeed, 0.01f, 100f);
|
||||
EditorGUILayout.EndToggleGroup ();
|
||||
|
||||
myTarget.ambientLighting = EditorGUILayout.BeginToggleGroup("Ambient Light Modifications", myTarget.ambientLighting);
|
||||
myTarget.ambientLightingMod = EditorGUILayout.ColorField ("Ambient Sky Lighting Mod", myTarget.ambientLightingMod);
|
||||
if (EnviroSkyMgr.instance != null && EnviroSkyMgr.instance.IsAvailable())
|
||||
{
|
||||
if (EnviroSkyMgr.instance.LightSettings.ambientMode == UnityEngine.Rendering.AmbientMode.Trilight)
|
||||
{
|
||||
myTarget.ambientEQLightingMod = EditorGUILayout.ColorField("Ambient Equator Lighting Mod", myTarget.ambientEQLightingMod);
|
||||
myTarget.ambientGRLightingMod = EditorGUILayout.ColorField("Ambient Ground Lighting Mod", myTarget.ambientGRLightingMod);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myTarget.ambientEQLightingMod = EditorGUILayout.ColorField("Ambient Equator Lighting Mod", myTarget.ambientEQLightingMod);
|
||||
myTarget.ambientGRLightingMod = EditorGUILayout.ColorField("Ambient Ground Lighting Mod", myTarget.ambientGRLightingMod);
|
||||
}
|
||||
|
||||
myTarget.ambientLightFadeSpeed = EditorGUILayout.Slider("Ambient Fading Speed", myTarget.ambientLightFadeSpeed, 0.01f, 100f);
|
||||
EditorGUILayout.EndToggleGroup ();
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Skybox", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.skybox = EditorGUILayout.BeginToggleGroup("Skybox Modifications", myTarget.skybox);
|
||||
myTarget.skyboxColorMod = EditorGUILayout.ColorField("Skybox Color Mod", myTarget.skyboxColorMod);
|
||||
myTarget.skyboxFadeSpeed = EditorGUILayout.Slider("Skybox Fading Speed", myTarget.skyboxFadeSpeed, 0.01f, 100f);
|
||||
EditorGUILayout.EndToggleGroup();
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical("Audio", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.ambientAudio = EditorGUILayout.BeginToggleGroup("Ambient Audio Modifications", myTarget.ambientAudio);
|
||||
myTarget.ambientVolume = EditorGUILayout.Slider ("Ambient Audio Mod", myTarget.ambientVolume,-1f,0f);
|
||||
EditorGUILayout.EndToggleGroup ();
|
||||
myTarget.weatherAudio = EditorGUILayout.BeginToggleGroup("Weather Audio Modifications", myTarget.weatherAudio);
|
||||
myTarget.weatherVolume = EditorGUILayout.Slider ("Weather Audio Mod", myTarget.weatherVolume,-1f,0f);
|
||||
EditorGUILayout.EndToggleGroup ();
|
||||
GUILayout.Space(20);
|
||||
GUILayout.Label("Zone Audio", headerStyle);
|
||||
myTarget.zoneAudioClip = (AudioClip)EditorGUILayout.ObjectField("Zone Ambient Clip", myTarget.zoneAudioClip, typeof(AudioClip), false);
|
||||
myTarget.zoneAudioVolume = EditorGUILayout.Slider("Zone Ambient Volume", myTarget.zoneAudioVolume, 0f, 1f);
|
||||
myTarget.zoneAudioFadingSpeed = EditorGUILayout.Slider("Zone Ambient Fading Speed", myTarget.zoneAudioFadingSpeed, 0.01f, 100f);
|
||||
GUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Fog", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.fogFadeSpeed = EditorGUILayout.Slider("Fog Fading Speed", myTarget.fogFadeSpeed, 0.01f, 100f);
|
||||
myTarget.fog = EditorGUILayout.BeginToggleGroup("Fog Intensity Modifications", myTarget.fog);
|
||||
myTarget.minFogMod = EditorGUILayout.Slider("Fog Min Value", myTarget.minFogMod, 0f, 1f);
|
||||
EditorGUILayout.EndToggleGroup();
|
||||
myTarget.fogColor = EditorGUILayout.BeginToggleGroup("Fog Color Modifications", myTarget.fogColor);
|
||||
myTarget.fogColorMod = EditorGUILayout.ColorField("Fog Color Mod", myTarget.fogColorMod);
|
||||
EditorGUILayout.EndToggleGroup();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.BeginVertical("Weather Effects", boxStyle);
|
||||
GUILayout.Space(20);
|
||||
myTarget.weatherEffects = EditorGUILayout.BeginToggleGroup("Weather Effects Modifications", myTarget.weatherEffects);
|
||||
myTarget.weatherFadeSpeed = EditorGUILayout.Slider("Weather Effects Fading Speed", myTarget.weatherFadeSpeed, 0.01f, 100f);
|
||||
EditorGUILayout.EndToggleGroup();
|
||||
GUILayout.EndVertical();
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e0c4c37818e68048864e1f95efa4581
|
||||
timeCreated: 1506756102
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,149 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
|
||||
[CustomEditor(typeof(EnviroReflectionProbe))]
|
||||
public class EnviroReflectionProbeEditor : Editor {
|
||||
|
||||
GUIStyle boxStyle;
|
||||
GUIStyle boxStyleModified;
|
||||
GUIStyle wrapStyle;
|
||||
GUIStyle wrapStyle2;
|
||||
GUIStyle clearStyle;
|
||||
|
||||
EnviroReflectionProbe myTarget;
|
||||
|
||||
public bool showAudio = false;
|
||||
public bool showFog = false;
|
||||
public bool showSeason = false;
|
||||
public bool showClouds = false;
|
||||
public bool showGeneral = false;
|
||||
public bool showPostProcessing = false;
|
||||
public bool showThirdParty = false;
|
||||
|
||||
private Color boxColor1;
|
||||
|
||||
SerializedObject serializedObj;
|
||||
#if ENVIRO_HD
|
||||
SerializedProperty customCloudsQuality;
|
||||
#endif
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroReflectionProbe)target;
|
||||
|
||||
serializedObj = new SerializedObject (myTarget);
|
||||
#if ENVIRO_HD
|
||||
customCloudsQuality = serializedObj.FindProperty("customCloudsQuality");
|
||||
#endif
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
boxColor1 = new Color(0.95f, 0.95f, 0.95f,1f);
|
||||
#else
|
||||
boxColor1 = new Color(0.85f, 0.85f, 0.85f, 1f);
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
|
||||
myTarget = (EnviroReflectionProbe)target;
|
||||
serializedObj.UpdateIfRequiredOrScript ();
|
||||
|
||||
//Set up the box style
|
||||
if (boxStyle == null)
|
||||
{
|
||||
boxStyle = new GUIStyle(GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (boxStyleModified == null)
|
||||
{
|
||||
boxStyleModified = new GUIStyle(EditorStyles.helpBox);
|
||||
boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyleModified.fontStyle = FontStyle.Bold;
|
||||
boxStyleModified.fontSize = 11;
|
||||
boxStyleModified.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
//Setup the wrap style
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Bold;
|
||||
wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
if (wrapStyle2 == null)
|
||||
{
|
||||
wrapStyle2 = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle2.fontStyle = FontStyle.Normal;
|
||||
wrapStyle2.wordWrap = true;
|
||||
}
|
||||
|
||||
if (clearStyle == null) {
|
||||
clearStyle = new GUIStyle(GUI.skin.label);
|
||||
clearStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
clearStyle.fontStyle = FontStyle.Bold;
|
||||
clearStyle.alignment = TextAnchor.UpperRight;
|
||||
}
|
||||
|
||||
|
||||
GUILayout.BeginVertical(" Enviro - Reflection Probe", boxStyle);
|
||||
GUILayout.Space(30);
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("Information", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space(20);
|
||||
EditorGUILayout.LabelField("Use this component to update your realtime reflection probes with Enviro Sky. You also can enable the 'Custom Rendering' to have enviro effects in your reflection probes!", wrapStyle2);
|
||||
EditorGUILayout.LabelField("Please enable 'Standalone Probe' if you use this component on your own places reflection probes.", wrapStyle2);
|
||||
GUILayout.EndVertical();
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("Setup", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space(20);
|
||||
myTarget.standalone = EditorGUILayout.Toggle("Standalone Probe", myTarget.standalone);
|
||||
|
||||
if (myTarget.standalone)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
#if ENVIRO_HD
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("Enviro Effects Rendering", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space(20);
|
||||
myTarget.customRendering = EditorGUILayout.Toggle("Render Enviro Effects", myTarget.customRendering);
|
||||
|
||||
if(myTarget.customRendering)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(customCloudsQuality, true, null);
|
||||
myTarget.useFog = EditorGUILayout.Toggle("Use Fog", myTarget.useFog);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObj.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
#endif
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("Update Settings", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space(20);
|
||||
myTarget.reflectionsUpdateTreshhold = EditorGUILayout.FloatField("Update Treshold in GameTime Hours", myTarget.reflectionsUpdateTreshhold);
|
||||
if (myTarget.customRendering)
|
||||
{
|
||||
myTarget.useTimeSlicing = EditorGUILayout.Toggle("Use Time-Slicing", myTarget.useTimeSlicing);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
// END
|
||||
EditorGUILayout.EndVertical ();
|
||||
EditorUtility.SetDirty (target);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cc79ea660fca334588f3fa576ee4f15
|
||||
timeCreated: 1497912081
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
using UnityEditor;
|
||||
|
||||
public class EnviroRemoveDefines : UnityEditor.AssetModificationProcessor
|
||||
{
|
||||
static string symbols;
|
||||
|
||||
public static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions rao)
|
||||
{
|
||||
|
||||
if (assetPath.Contains("Enviro Standard"))
|
||||
{
|
||||
symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
||||
if (symbols.Contains("ENVIRO_HD"))
|
||||
{
|
||||
symbols = symbols.Replace("ENVIRO_HD;", "");
|
||||
symbols = symbols.Replace("ENVIRO_HD", "");
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
|
||||
}
|
||||
}
|
||||
|
||||
if (assetPath.Contains("Enviro Lite"))
|
||||
{
|
||||
symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
||||
|
||||
if (symbols.Contains("ENVIRO_LW"))
|
||||
{
|
||||
symbols = symbols.Replace("ENVIRO_LW;", "");
|
||||
symbols = symbols.Replace("ENVIRO_LW", "");
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
|
||||
}
|
||||
}
|
||||
|
||||
if (assetPath.Contains("Enviro Pro"))
|
||||
{
|
||||
symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
||||
|
||||
if (symbols.Contains("ENVIRO_PRO"))
|
||||
{
|
||||
symbols = symbols.Replace("ENVIRO_PRO;", "");
|
||||
symbols = symbols.Replace("ENVIRO_PRO", "");
|
||||
symbols = symbols.Replace("ENVIRO_LWRP", "");
|
||||
symbols = symbols.Replace("ENVIRO_LWRP;", "");
|
||||
symbols = symbols.Replace("ENVIRO_HDRP", "");
|
||||
symbols = symbols.Replace("ENVIRO_HDRP;", "");
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, symbols);
|
||||
}
|
||||
}
|
||||
|
||||
return AssetDeleteResult.DidNotDelete;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bf7e5fae5af33f44bdd48d48ca24d54
|
||||
timeCreated: 1536497567
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8349e3720abe11b409ed35ad03c87e21
|
||||
timeCreated: 1506756102
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,434 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
|
||||
[CustomEditor(typeof(EnviroWeatherPreset))]
|
||||
public class EnviroWeatherPresetEditor : Editor {
|
||||
|
||||
GUIStyle boxStyle;
|
||||
GUIStyle boxStyleModified;
|
||||
GUIStyle wrapStyle;
|
||||
GUIStyle wrapStyle2;
|
||||
GUIStyle clearStyle;
|
||||
GUIStyle headerFoldout;
|
||||
GUIStyle headerStyle;
|
||||
|
||||
EnviroWeatherPreset myTarget;
|
||||
|
||||
public bool showAudio = false;
|
||||
public bool showFog = false;
|
||||
public bool showSeason = false;
|
||||
public bool showClouds = false;
|
||||
public bool showGeneral = false;
|
||||
public bool showPostProcessing = false;
|
||||
public bool showThirdParty = false;
|
||||
|
||||
SerializedObject serializedObj;
|
||||
SerializedProperty fogMod;
|
||||
SerializedProperty skyMod;
|
||||
SerializedProperty lightMod;
|
||||
|
||||
private Color boxColor1;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroWeatherPreset)target;
|
||||
|
||||
serializedObj = new SerializedObject (myTarget);
|
||||
fogMod = serializedObj.FindProperty ("weatherFogMod");
|
||||
skyMod = serializedObj.FindProperty ("weatherSkyMod");
|
||||
lightMod = serializedObj.FindProperty ("weatherLightMod");
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
boxColor1 = new Color(0.95f, 0.95f, 0.95f,1f);
|
||||
#else
|
||||
boxColor1 = new Color(0.85f, 0.85f, 0.85f, 1f);
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
|
||||
myTarget = (EnviroWeatherPreset)target;
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
serializedObj.UpdateIfRequiredOrScript ();
|
||||
#else
|
||||
serializedObj.UpdateIfDirtyOrScript ();
|
||||
#endif
|
||||
//Set up the box style
|
||||
if (boxStyle == null)
|
||||
{
|
||||
boxStyle = new GUIStyle(GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (boxStyleModified == null)
|
||||
{
|
||||
boxStyleModified = new GUIStyle(EditorStyles.helpBox);
|
||||
boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyleModified.fontStyle = FontStyle.Bold;
|
||||
boxStyleModified.fontSize = 11;
|
||||
boxStyleModified.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
//Setup the wrap style
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Normal;
|
||||
wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
if (wrapStyle2 == null)
|
||||
{
|
||||
wrapStyle2 = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle2.fontStyle = FontStyle.Italic;
|
||||
wrapStyle2.wordWrap = true;
|
||||
}
|
||||
|
||||
if (clearStyle == null) {
|
||||
clearStyle = new GUIStyle(GUI.skin.label);
|
||||
clearStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
clearStyle.fontStyle = FontStyle.Bold;
|
||||
clearStyle.alignment = TextAnchor.UpperRight;
|
||||
}
|
||||
|
||||
if (headerFoldout == null)
|
||||
{
|
||||
headerFoldout = new GUIStyle(EditorStyles.foldout);
|
||||
headerFoldout.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
if (headerStyle == null)
|
||||
{
|
||||
headerStyle = new GUIStyle(GUI.skin.label);
|
||||
headerStyle.fontStyle = FontStyle.Bold;
|
||||
headerStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
// Begin
|
||||
GUILayout.BeginVertical("", boxStyle);
|
||||
EditorGUILayout.LabelField("Enviro - Weather Preset", headerStyle);
|
||||
EditorGUILayout.LabelField("Setup a new weather type here. Change clouds, lighting, audio and so on and add this preset to one of your enviro weather zones to make it usable in enviro weather system. Do not forget to set a unique name in 'General Configs'!", wrapStyle);
|
||||
GUILayout.Space(10);
|
||||
|
||||
// General Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showGeneral = GUILayout.Toggle(showGeneral, "General Configs", headerFoldout);
|
||||
if (showGeneral) {
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUILayout.BeginVertical("Unique Name", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name);
|
||||
EditorGUILayout.EndVertical();
|
||||
GUILayout.BeginVertical("Sky and Light Color", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
EditorGUILayout.PropertyField(skyMod, true, null);
|
||||
|
||||
|
||||
EditorGUILayout.PropertyField(lightMod, true, null);
|
||||
|
||||
myTarget.volumeLightIntensity = EditorGUILayout.Slider("Volume Light Intensity", myTarget.volumeLightIntensity, 0, 2);
|
||||
|
||||
myTarget.shadowIntensityMod = EditorGUILayout.Slider("Shadow Intensity Mod", myTarget.shadowIntensityMod, -1f, 1f);
|
||||
#if ENVIRO_HDRP
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.LightSettings.usePhysicalBasedLighting)
|
||||
{
|
||||
myTarget.sceneExposureMod = EditorGUILayout.Slider("Scene Exposure Modification", myTarget.sceneExposureMod, 0, 2);
|
||||
myTarget.skyExposureMod = EditorGUILayout.Slider("Sky Exposure Modification", myTarget.skyExposureMod, 0, 2);
|
||||
myTarget.lightIntensityMod = EditorGUILayout.Slider("Light Intensity Modification", myTarget.lightIntensityMod, 0, 2);
|
||||
}
|
||||
#endif
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObj.ApplyModifiedProperties();
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Weather Condition", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.WindStrenght = EditorGUILayout.Slider("Wind Intensity",myTarget.WindStrenght,0f,1f);
|
||||
myTarget.wetnessLevel = EditorGUILayout.Slider("Maximum Wetness",myTarget.wetnessLevel,0f,1f);
|
||||
myTarget.snowLevel = EditorGUILayout.Slider("Maximum Snow",myTarget.snowLevel,0f,1f);
|
||||
myTarget.temperatureLevel = EditorGUILayout.Slider("Temperature Modification", myTarget.temperatureLevel, -50f, 50f);
|
||||
myTarget.isLightningStorm = EditorGUILayout.Toggle ("Lightning Storm", myTarget.isLightningStorm);
|
||||
myTarget.lightningInterval = EditorGUILayout.Slider("Lightning Interval",myTarget.lightningInterval,2f,60f);
|
||||
EditorGUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical("Particle Effects", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
if (!Application.isPlaying) {
|
||||
if (GUILayout.Button ("Add")) {
|
||||
myTarget.effectSystems.Add (new EnviroWeatherEffects ());
|
||||
}
|
||||
} else
|
||||
EditorGUILayout.LabelField ("Can't add effects in runtime!");
|
||||
|
||||
for (int i = 0; i < myTarget.effectSystems.Count; i++) {
|
||||
GUILayout.BeginVertical ("Effect " + (i+1), boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.effectSystems[i].prefab = (GameObject)EditorGUILayout.ObjectField ("Effect Prefab", myTarget.effectSystems[i].prefab, typeof(GameObject), true);
|
||||
myTarget.effectSystems [i].localPositionOffset = EditorGUILayout.Vector3Field ("Position Offset", myTarget.effectSystems [i].localPositionOffset);
|
||||
myTarget.effectSystems [i].localRotationOffset = EditorGUILayout.Vector3Field ("Rotation Offset", myTarget.effectSystems [i].localRotationOffset);
|
||||
if (GUILayout.Button ("Remove")) {
|
||||
myTarget.effectSystems.Remove (myTarget.effectSystems[i]);
|
||||
}
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
#if ENVIRO_HD
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD)
|
||||
{
|
||||
GUILayout.BeginVertical("Aurora Settings", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.auroraIntensity = EditorGUILayout.Slider("Aurora Intensity", myTarget.auroraIntensity, 0f, 1f);
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
// Season Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showSeason = GUILayout.Toggle(showSeason, "Season Configs", headerFoldout);
|
||||
if (showSeason) {
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
myTarget.Spring = EditorGUILayout.Toggle ("Spring",myTarget.Spring);
|
||||
if (myTarget.Spring)
|
||||
myTarget.possibiltyInSpring = EditorGUILayout.Slider ("Spring Possibility",myTarget.possibiltyInSpring, 0, 100);
|
||||
myTarget.Summer = EditorGUILayout.Toggle ("Summer",myTarget.Summer);
|
||||
if (myTarget.Summer)
|
||||
myTarget.possibiltyInSummer = EditorGUILayout.Slider ("Summer Possibility",myTarget.possibiltyInSummer, 0, 100);
|
||||
myTarget.Autumn = EditorGUILayout.Toggle ("Autumn",myTarget.Autumn);
|
||||
if (myTarget.Autumn)
|
||||
myTarget.possibiltyInAutumn = EditorGUILayout.Slider ("Autumn Possibility",myTarget.possibiltyInAutumn, 0, 100);
|
||||
myTarget.winter = EditorGUILayout.Toggle ("Winter",myTarget.winter);
|
||||
if (myTarget.winter)
|
||||
myTarget.possibiltyInWinter = EditorGUILayout.Slider ("Winter Possibility",myTarget.possibiltyInWinter, 0, 100);
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
|
||||
// Clouds Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showClouds = GUILayout.Toggle(showClouds, "Clouds Configs", headerFoldout);
|
||||
if (showClouds) {
|
||||
//Add Cloud Stuff
|
||||
#if ENVIRO_HD
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD)
|
||||
{
|
||||
GUILayout.BeginVertical("Volume Clouds", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
myTarget.cloudsConfig.scatteringCoef = EditorGUILayout.Slider("Direct Light Intensity", myTarget.cloudsConfig.scatteringCoef, 0f, 2f);
|
||||
myTarget.cloudsConfig.ambientSkyColorIntensity = EditorGUILayout.Slider("Ambient Color Intensity", myTarget.cloudsConfig.ambientSkyColorIntensity, 0f, 2f);
|
||||
GUILayout.Space(10);
|
||||
myTarget.cloudsConfig.edgeDarkness = EditorGUILayout.Slider("Powder Term Intensity", myTarget.cloudsConfig.edgeDarkness, 0.4f, 0.99f);
|
||||
myTarget.cloudsConfig.lightAbsorbtion = EditorGUILayout.Slider("Light Absorbtion", myTarget.cloudsConfig.lightAbsorbtion, 0.0f, 1f);
|
||||
myTarget.cloudsConfig.lightStepModifier = EditorGUILayout.Slider("Light Step Modifier", myTarget.cloudsConfig.lightStepModifier, 0.01f, 2.0f);
|
||||
myTarget.cloudsConfig.lightVariance = EditorGUILayout.Slider("Light Variance Intensity", myTarget.cloudsConfig.lightVariance, 0.0f, 1.0f);
|
||||
GUILayout.Space(10);
|
||||
myTarget.cloudsConfig.density = EditorGUILayout.Slider("Density", myTarget.cloudsConfig.density, 0.1f, 4f);
|
||||
GUILayout.Space(10);
|
||||
myTarget.cloudsConfig.baseErosionIntensity = EditorGUILayout.Slider("Base Erosion Intensity", myTarget.cloudsConfig.baseErosionIntensity, 0f, 1f);
|
||||
myTarget.cloudsConfig.detailErosionIntensity = EditorGUILayout.Slider("Detail Erosion Intensity", myTarget.cloudsConfig.detailErosionIntensity, 0f, 1f);
|
||||
GUILayout.Space(10);
|
||||
myTarget.cloudsConfig.coverage = EditorGUILayout.Slider("Coverage", myTarget.cloudsConfig.coverage, -1f, 1f);
|
||||
myTarget.cloudsConfig.coverageType = EditorGUILayout.Slider("Coverage Type", myTarget.cloudsConfig.coverageType, 0f, 1f);
|
||||
myTarget.cloudsConfig.cloudType = EditorGUILayout.Slider("Cloud Type", myTarget.cloudsConfig.cloudType, 0f, 1f);
|
||||
GUILayout.Space(10);
|
||||
myTarget.cloudsConfig.raymarchingScale = EditorGUILayout.Slider("Raymarch Step Modifier", myTarget.cloudsConfig.raymarchingScale, 0.25f, 2f);
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
#endif
|
||||
GUILayout.BeginVertical("Flat Clouds", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
myTarget.cloudsConfig.flatCoverage = EditorGUILayout.Slider("Flat Clouds Coverage", myTarget.cloudsConfig.flatCoverage, 0f, 2f);
|
||||
GUILayout.Space(5);
|
||||
myTarget.cloudsConfig.flatCloudsDensity = EditorGUILayout.Slider("Flat Clouds Density", myTarget.cloudsConfig.flatCloudsDensity, 0f, 5f);
|
||||
myTarget.cloudsConfig.flatCloudsAbsorbtion = EditorGUILayout.Slider("Flat Clouds Absorbtion", myTarget.cloudsConfig.flatCloudsAbsorbtion, 0f, 10f);
|
||||
myTarget.cloudsConfig.flatCloudsDirectLightIntensity = EditorGUILayout.Slider("Flat Clouds Direct Light Intensity", myTarget.cloudsConfig.flatCloudsDirectLightIntensity, 0f, 100f);
|
||||
myTarget.cloudsConfig.flatCloudsAmbientLightIntensity = EditorGUILayout.Slider("Flat Clouds Ambient Light Intensity", myTarget.cloudsConfig.flatCloudsAmbientLightIntensity, 0.0f, 2f);
|
||||
myTarget.cloudsConfig.flatCloudsHGPhase = EditorGUILayout.Slider("Flat Clouds HG Phase", myTarget.cloudsConfig.flatCloudsHGPhase, 0.0f, 1f);
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
|
||||
GUILayout.BeginVertical("Particle Clouds", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
#if ENVIRO_HD
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD)
|
||||
{
|
||||
myTarget.cloudsConfig.particleCloudsOverwrite = EditorGUILayout.Toggle("Enable Particle Clouds Overwrite", myTarget.cloudsConfig.particleCloudsOverwrite);
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
#endif
|
||||
myTarget.cloudsConfig.particleLayer1Alpha = EditorGUILayout.Slider("Layer 1 Alpha", myTarget.cloudsConfig.particleLayer1Alpha, 0f, 1f);
|
||||
myTarget.cloudsConfig.particleLayer1Brightness = EditorGUILayout.Slider("Layer 1 Brightness", myTarget.cloudsConfig.particleLayer1Brightness, 0f, 1f);
|
||||
myTarget.cloudsConfig.particleLayer1ColorPow = EditorGUILayout.Slider("Layer 1 Color Power", myTarget.cloudsConfig.particleLayer1ColorPow, 0.1f, 5f);
|
||||
GUILayout.Space(20);
|
||||
myTarget.cloudsConfig.particleLayer2Alpha = EditorGUILayout.Slider("Layer 2 Alpha", myTarget.cloudsConfig.particleLayer2Alpha, 0f, 1f);
|
||||
myTarget.cloudsConfig.particleLayer2Brightness = EditorGUILayout.Slider("Layer 2 Brightness", myTarget.cloudsConfig.particleLayer2Brightness, 0f, 1f);
|
||||
myTarget.cloudsConfig.particleLayer2ColorPow = EditorGUILayout.Slider("Layer 2 Color Power", myTarget.cloudsConfig.particleLayer2ColorPow, 0.1f, 5f);
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
GUILayout.BeginVertical("Cirrus Clouds", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
myTarget.cloudsConfig.cirrusAlpha = EditorGUILayout.Slider ("Cirrus Clouds Alpha", myTarget.cloudsConfig.cirrusAlpha,0f,1f);
|
||||
myTarget.cloudsConfig.cirrusCoverage = EditorGUILayout.Slider ("Cirrus Clouds Coverage", myTarget.cloudsConfig.cirrusCoverage,0f,1f);
|
||||
myTarget.cloudsConfig.cirrusColorPow = EditorGUILayout.Slider ("Cirrus Clouds Color Power", myTarget.cloudsConfig.cirrusColorPow,0.1f,5f);
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
// Fog Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showFog = GUILayout.Toggle(showFog, "Fog Configs", headerFoldout);
|
||||
if (showFog) {
|
||||
GUILayout.BeginVertical ("Fog Intensity", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
GUILayout.BeginVertical ("Linear", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.fogStartDistance = EditorGUILayout.FloatField ("Start Distance", myTarget.fogStartDistance);
|
||||
myTarget.fogDistance = EditorGUILayout.FloatField ("End Distance", myTarget.fogDistance);
|
||||
EditorGUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical ("EXP", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.fogDensity = EditorGUILayout.FloatField ("Density", myTarget.fogDensity);
|
||||
EditorGUILayout.EndVertical ();
|
||||
GUILayout.BeginVertical ("Height", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.heightFogDensity = EditorGUILayout.Slider ("Height Fog Density", myTarget.heightFogDensity,0f,10f);
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
#if ENVIRO_HDRP
|
||||
GUILayout.BeginVertical("HDRP", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.fogAttenuationDistance = EditorGUILayout.Slider("Attenuation Distance", myTarget.fogAttenuationDistance, 1f, 10000f);
|
||||
myTarget.fogRelativeFogHeight = EditorGUILayout.Slider("Relative Fog Height", myTarget.fogRelativeFogHeight, -1000f, 1000f);
|
||||
EditorGUILayout.EndVertical();
|
||||
#endif
|
||||
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
GUILayout.BeginVertical ("Advanced", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(fogMod, true, null);
|
||||
if(EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObj.ApplyModifiedProperties();
|
||||
}
|
||||
myTarget.FogScatteringIntensity = EditorGUILayout.Slider ("Scattering Intensity", myTarget.FogScatteringIntensity,1f,10f);
|
||||
myTarget.fogSunBlocking = EditorGUILayout.Slider ("Sundisk Intensity", myTarget.fogSunBlocking,0f,1f);
|
||||
EditorGUILayout.EndVertical();
|
||||
GUILayout.BeginVertical ("Sky Fog", boxStyleModified);
|
||||
GUILayout.Space(15);
|
||||
myTarget.skyFogStart = EditorGUILayout.Slider("Sky Fog Start", myTarget.skyFogStart, 0f, 0.2f);
|
||||
myTarget.SkyFogHeight = EditorGUILayout.Slider ("Sky Fog Height", myTarget.SkyFogHeight,0f,5f);
|
||||
myTarget.SkyFogIntensity = EditorGUILayout.Slider ("Sky Fog Intensity", myTarget.SkyFogIntensity,0f,1f);
|
||||
#if ENVIRO_LW
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.LW)
|
||||
{
|
||||
myTarget.moonIntensity = EditorGUILayout.Slider("Moon Intensity", myTarget.moonIntensity, 0.0f, 1f);
|
||||
}
|
||||
#endif
|
||||
EditorGUILayout.EndVertical ();
|
||||
EditorGUILayout.EndVertical ();
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
#if ENVIRO_HD
|
||||
if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD)
|
||||
{
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showPostProcessing = GUILayout.Toggle(showPostProcessing, "Distance Blur Configs", headerFoldout);
|
||||
if (showPostProcessing)
|
||||
{
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
myTarget.blurDistance = EditorGUILayout.Slider("Blur Distance", myTarget.blurDistance, 0f, 5000f);
|
||||
myTarget.blurIntensity = EditorGUILayout.Slider("Blur Intensity", myTarget.blurIntensity, 0f, 1f);
|
||||
myTarget.blurSkyIntensity = EditorGUILayout.Slider("Sky Blur Intensity", myTarget.blurSkyIntensity, 0f, 5f);
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Audio Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showAudio = GUILayout.Toggle(showAudio, "Audio Configs", headerFoldout);
|
||||
if (showAudio) {
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
myTarget.weatherSFX = (AudioClip)EditorGUILayout.ObjectField ("Weather Soundeffect",myTarget.weatherSFX, typeof(AudioClip), true);
|
||||
GUILayout.Space(10);
|
||||
myTarget.SpringDayAmbient = (AudioClip)EditorGUILayout.ObjectField ("Spring Day Ambient",myTarget.SpringDayAmbient, typeof(AudioClip), true);
|
||||
myTarget.SpringNightAmbient = (AudioClip)EditorGUILayout.ObjectField ("Spring Night Ambient",myTarget.SpringNightAmbient, typeof(AudioClip), true);
|
||||
GUILayout.Space(10);
|
||||
myTarget.SummerDayAmbient = (AudioClip)EditorGUILayout.ObjectField ("Summer Day Ambient",myTarget.SummerDayAmbient, typeof(AudioClip), true);
|
||||
myTarget.SummerNightAmbient = (AudioClip)EditorGUILayout.ObjectField ("Summer Night Ambient",myTarget.SummerNightAmbient, typeof(AudioClip), true);
|
||||
GUILayout.Space(10);
|
||||
myTarget.AutumnDayAmbient = (AudioClip)EditorGUILayout.ObjectField ("Autumn Day Ambient",myTarget.AutumnDayAmbient, typeof(AudioClip), true);
|
||||
myTarget.AutumnNightAmbient = (AudioClip)EditorGUILayout.ObjectField ("Autumn Night Ambient",myTarget.AutumnNightAmbient, typeof(AudioClip), true);
|
||||
GUILayout.Space(10);
|
||||
myTarget.WinterDayAmbient = (AudioClip)EditorGUILayout.ObjectField ("Winter Day Ambient",myTarget.WinterDayAmbient, typeof(AudioClip), true);
|
||||
myTarget.WinterNightAmbient = (AudioClip)EditorGUILayout.ObjectField ("Winter Night Ambient",myTarget.WinterNightAmbient, typeof(AudioClip), true);
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
#if AURA_IN_PROJECT
|
||||
// Third Party Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showThirdParty = GUILayout.Toggle(showThirdParty, "Third Party Integrations", headerFoldout);
|
||||
if (showThirdParty)
|
||||
{
|
||||
GUILayout.BeginVertical("Aura 2", boxStyleModified);
|
||||
GUILayout.Space(20);
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
EditorGUILayout.LabelField("Set Aura2 settings for each weather preset here. Please also activate Aura 2 Integration in Enviro Sky Manager -> Third Party Integration!", wrapStyle2);
|
||||
//myTarget.auraPreset = (Aura2API.AuraBaseSettings)EditorGUILayout.ObjectField("Aura 2 Preset", myTarget.auraPreset, typeof(Aura2API.AuraBaseSettings), true);
|
||||
myTarget.enviroAura2Config.aura2GlobalDensity = EditorGUILayout.Slider("Global Density", myTarget.enviroAura2Config.aura2GlobalDensity, 0f, 10f);
|
||||
myTarget.enviroAura2Config.aura2GlobalScattering = EditorGUILayout.Slider("Global Scattering", myTarget.enviroAura2Config.aura2GlobalScattering, 0f, 1f);
|
||||
myTarget.enviroAura2Config.aura2GlobalAmbientLight = EditorGUILayout.Slider("Global Ambient Light", myTarget.enviroAura2Config.aura2GlobalAmbientLight, 0f, 10f);
|
||||
myTarget.enviroAura2Config.aura2GlobalExtinction = EditorGUILayout.Slider("Global Extiction", myTarget.enviroAura2Config.aura2GlobalExtinction, 0f, 1f);
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
#endif
|
||||
|
||||
|
||||
// END
|
||||
EditorGUILayout.EndVertical ();
|
||||
EditorUtility.SetDirty (target);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f2d5abe7000d514ca6599d043dcd033
|
||||
timeCreated: 1497912081
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,183 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
||||
|
||||
[CustomEditor(typeof(EnviroZone))]
|
||||
public class EnviroEnviroZoneEditor : Editor {
|
||||
|
||||
GUIStyle boxStyle;
|
||||
GUIStyle boxStyleModified;
|
||||
GUIStyle wrapStyle;
|
||||
GUIStyle clearStyle;
|
||||
GUIStyle headerStyle;
|
||||
GUIStyle headerFoldout;
|
||||
GUIStyle popUpStyle;
|
||||
|
||||
EnviroZone myTarget;
|
||||
|
||||
bool showGizmo = true;
|
||||
bool showGeneral = true;
|
||||
bool showWeather = true;
|
||||
|
||||
private Color boxColor1;
|
||||
|
||||
ReorderableList weatherList;
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
myTarget = (EnviroZone)target;
|
||||
|
||||
weatherList = new ReorderableList(serializedObject,serializedObject.FindProperty("zoneWeatherPresets"),true, true, true, true);
|
||||
weatherList.drawHeaderCallback = (Rect rect) =>
|
||||
{
|
||||
EditorGUI.LabelField(rect, "Weather Presets:");
|
||||
};
|
||||
|
||||
weatherList.drawElementCallback =
|
||||
(Rect rect, int index, bool isActive, bool isFocused) => {
|
||||
var element = weatherList.serializedProperty.GetArrayElementAtIndex(index);
|
||||
rect.y += 2;
|
||||
EditorGUI.PropertyField(new Rect(rect.x, rect.y, Screen.width * 0.8f, EditorGUIUtility.singleLineHeight),element,GUIContent.none);
|
||||
};
|
||||
|
||||
weatherList.onAddCallback = (ReorderableList l) =>
|
||||
{
|
||||
var index = l.serializedProperty.arraySize;
|
||||
l.serializedProperty.arraySize++;
|
||||
l.index = index;
|
||||
//var element = l.serializedProperty.GetArrayElementAtIndex(index);
|
||||
};
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
boxColor1 = new Color(0.95f, 0.95f, 0.95f,1f);
|
||||
#else
|
||||
boxColor1 = new Color(0.85f, 0.85f, 0.85f, 1f);
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
|
||||
myTarget = (EnviroZone)target;
|
||||
|
||||
//Set up the box style
|
||||
if (boxStyle == null)
|
||||
{
|
||||
boxStyle = new GUIStyle(GUI.skin.box);
|
||||
boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyle.fontStyle = FontStyle.Bold;
|
||||
boxStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (boxStyleModified == null)
|
||||
{
|
||||
boxStyleModified = new GUIStyle(EditorStyles.helpBox);
|
||||
boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
boxStyleModified.fontStyle = FontStyle.Bold;
|
||||
boxStyleModified.fontSize = 11;
|
||||
boxStyleModified.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
//Setup the wrap style
|
||||
if (wrapStyle == null)
|
||||
{
|
||||
wrapStyle = new GUIStyle(GUI.skin.label);
|
||||
wrapStyle.fontStyle = FontStyle.Normal;
|
||||
wrapStyle.wordWrap = true;
|
||||
}
|
||||
|
||||
if (clearStyle == null) {
|
||||
clearStyle = new GUIStyle(GUI.skin.label);
|
||||
clearStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
clearStyle.fontStyle = FontStyle.Bold;
|
||||
clearStyle.alignment = TextAnchor.UpperRight;
|
||||
}
|
||||
|
||||
if (headerStyle == null)
|
||||
{
|
||||
headerStyle = new GUIStyle(GUI.skin.label);
|
||||
headerStyle.fontStyle = FontStyle.Bold;
|
||||
headerStyle.alignment = TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
if (headerFoldout == null)
|
||||
{
|
||||
headerFoldout = new GUIStyle(EditorStyles.foldout);
|
||||
headerFoldout.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
if (popUpStyle == null)
|
||||
{
|
||||
popUpStyle = new GUIStyle(EditorStyles.popup);
|
||||
popUpStyle.alignment = TextAnchor.MiddleCenter;
|
||||
popUpStyle.fixedHeight = 20f;
|
||||
popUpStyle.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
// Begin
|
||||
GUILayout.BeginVertical("", boxStyle);
|
||||
EditorGUILayout.LabelField("Enviro - Weather Zone", headerStyle);
|
||||
EditorGUILayout.LabelField("Add your weather presets for this biome here. You can have multiple zones and each zone will have its own current weather state. Once your player enters the zone weather will change.", wrapStyle);
|
||||
|
||||
// General Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showGeneral = GUILayout.Toggle(showGeneral, "General Configs", headerFoldout);
|
||||
if (showGeneral) {
|
||||
myTarget.zoneName = EditorGUILayout.TextField("Zone Name", myTarget.zoneName);
|
||||
GUILayout.Space(5);
|
||||
myTarget.useMeshZone = EditorGUILayout.Toggle("Use Custom Mesh", myTarget.useMeshZone);
|
||||
if(myTarget.useMeshZone)
|
||||
myTarget.zoneMesh = (Mesh)EditorGUILayout.ObjectField("Mesh", myTarget.zoneMesh,typeof(Mesh),false);
|
||||
myTarget.zoneScale = EditorGUILayout.Vector3Field ("Zone Scale", myTarget.zoneScale);
|
||||
GUILayout.Space(5);
|
||||
myTarget.ExitToDefault = EditorGUILayout.Toggle("Exit to Default Zone", myTarget.ExitToDefault);
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
// Weather Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showWeather = GUILayout.Toggle(showWeather, "Weather Configs", headerFoldout);
|
||||
if (showWeather) {
|
||||
|
||||
//GUILayout.Space(15);
|
||||
myTarget.updateMode = (EnviroZone.WeatherUpdateMode)EditorGUILayout.EnumPopup ("Weather Update Mode", myTarget.updateMode);
|
||||
myTarget.WeatherUpdateIntervall = EditorGUILayout.FloatField ("Weather Update Interval", myTarget.WeatherUpdateIntervall);
|
||||
myTarget.forceWeatherChange = EditorGUILayout.Toggle("Force Weather Changes", myTarget.forceWeatherChange);
|
||||
|
||||
GUILayout.Space(10);
|
||||
weatherList.DoLayoutList();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
// Gizmo Setup
|
||||
GUI.backgroundColor = boxColor1;
|
||||
GUILayout.BeginVertical("", boxStyleModified);
|
||||
GUI.backgroundColor = Color.white;
|
||||
showGizmo = GUILayout.Toggle(showGizmo, "Gizmo", headerFoldout);
|
||||
if (showGizmo) {
|
||||
myTarget.zoneGizmoColor = EditorGUILayout.ColorField ("Gizmo Color", myTarget.zoneGizmoColor);
|
||||
}
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
|
||||
// END
|
||||
EditorGUILayout.EndVertical ();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a33a74d22cfb41345a88a787c57a7d9f
|
||||
timeCreated: 1497912081
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2176fd5f3aabeb4fb254fd6fe1df4f9
|
||||
folderAsset: yes
|
||||
timeCreated: 1456624976
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,313 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
//[ImageEffectAllowedInSceneView]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public class EnviroPostProcessing : MonoBehaviour
|
||||
{
|
||||
|
||||
private Camera cam;
|
||||
|
||||
/// LightShafts
|
||||
public enum SunShaftsResolution
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2,
|
||||
}
|
||||
|
||||
public enum ShaftsScreenBlendMode
|
||||
{
|
||||
Screen = 0,
|
||||
Add = 1,
|
||||
}
|
||||
|
||||
[HideInInspector]
|
||||
public int radialBlurIterations = 2;
|
||||
|
||||
private Material sunShaftsMaterial;
|
||||
private Material moonShaftsMaterial;
|
||||
private Material simpleSunClearMaterial;
|
||||
private Material simpleMoonClearMaterial;
|
||||
private RenderTexture tempTexture;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (cam == null)
|
||||
cam = GetComponent<Camera>();
|
||||
|
||||
#if ENVIRO_LWRP || ENVIRO_HDRP
|
||||
this.enabled = false;
|
||||
return;
|
||||
#endif
|
||||
|
||||
CreateMaterialsAndTextures();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
CleanupMaterials();
|
||||
if (cam.actualRenderingPath == RenderingPath.Forward)
|
||||
{
|
||||
//Reset to Normal Depth Mode.
|
||||
if (cam.depthTextureMode == DepthTextureMode.Depth)
|
||||
{
|
||||
if (cam.depthTextureMode == DepthTextureMode.Depth)
|
||||
cam.depthTextureMode = DepthTextureMode.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateMaterialsAndTextures()
|
||||
{
|
||||
|
||||
sunShaftsMaterial = new Material(Shader.Find("Enviro/Effects/LightShafts"));
|
||||
moonShaftsMaterial = new Material(Shader.Find("Enviro/Effects/LightShafts"));
|
||||
simpleSunClearMaterial = new Material(Shader.Find("Enviro/Effects/ClearLightShafts"));
|
||||
simpleMoonClearMaterial = new Material(Shader.Find("Enviro/Effects/ClearLightShafts"));
|
||||
}
|
||||
|
||||
void CleanupMaterials()
|
||||
{
|
||||
if (sunShaftsMaterial != null)
|
||||
DestroyImmediate(sunShaftsMaterial);
|
||||
if (moonShaftsMaterial != null)
|
||||
DestroyImmediate(moonShaftsMaterial);
|
||||
if (simpleSunClearMaterial != null)
|
||||
DestroyImmediate(simpleSunClearMaterial);
|
||||
if (simpleMoonClearMaterial != null)
|
||||
DestroyImmediate(simpleMoonClearMaterial);
|
||||
}
|
||||
|
||||
void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
if (EnviroSkyMgr.instance == null || !EnviroSkyMgr.instance.IsAvailable() || (EnviroSkyMgr.instance.useSunShafts == false && EnviroSkyMgr.instance.useMoonShafts == false))
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
// Disable Depth Rendering in Forward. Possible problems with other effects not reanble this every frame!
|
||||
if (cam.actualRenderingPath == RenderingPath.Forward)
|
||||
{
|
||||
if (cam.depthTextureMode == DepthTextureMode.Depth)
|
||||
cam.depthTextureMode = DepthTextureMode.None;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// we actually need to check this every frame
|
||||
if (cam.actualRenderingPath == RenderingPath.Forward)
|
||||
{
|
||||
cam.depthTextureMode |= DepthTextureMode.Depth;
|
||||
}
|
||||
|
||||
////////////// Temp RenderTextures ///////////////////
|
||||
tempTexture = RenderTexture.GetTemporary(source.descriptor);
|
||||
|
||||
if (sunShaftsMaterial == null)
|
||||
{
|
||||
CleanupMaterials();
|
||||
CreateMaterialsAndTextures();
|
||||
}
|
||||
|
||||
/////////// Light Shafts ///////////////////////
|
||||
if (EnviroSkyMgr.instance.useSunShafts && EnviroSkyMgr.instance.useMoonShafts)
|
||||
{
|
||||
//Sun Shafts
|
||||
RenderLightShaft(source, tempTexture, sunShaftsMaterial, simpleSunClearMaterial, EnviroSkyMgr.instance.Components.Sun.transform, EnviroSkyMgr.instance.LightShaftsSettings.thresholdColorSun.Evaluate(EnviroSkyMgr.instance.Time.solarTime), EnviroSkyMgr.instance.LightShaftsSettings.lightShaftsColorSun.Evaluate(EnviroSkyMgr.instance.Time.solarTime));
|
||||
//Moon Shafts
|
||||
RenderLightShaft(tempTexture, destination, moonShaftsMaterial, simpleMoonClearMaterial, EnviroSkyMgr.instance.Components.Moon.transform, EnviroSkyMgr.instance.LightShaftsSettings.thresholdColorMoon.Evaluate(EnviroSkyMgr.instance.Time.solarTime), EnviroSkyMgr.instance.LightShaftsSettings.lightShaftsColorMoon.Evaluate(EnviroSkyMgr.instance.Time.solarTime));
|
||||
}
|
||||
else if (EnviroSkyMgr.instance.useSunShafts)
|
||||
{
|
||||
//Sun Shafts
|
||||
RenderLightShaft(source, destination, sunShaftsMaterial, simpleSunClearMaterial, EnviroSkyMgr.instance.Components.Sun.transform, EnviroSkyMgr.instance.LightShaftsSettings.thresholdColorSun.Evaluate(EnviroSkyMgr.instance.Time.solarTime), EnviroSkyMgr.instance.LightShaftsSettings.lightShaftsColorSun.Evaluate(EnviroSkyMgr.instance.Time.solarTime));
|
||||
}
|
||||
else if (EnviroSkyMgr.instance.useMoonShafts)
|
||||
{
|
||||
//Moon Shafts
|
||||
RenderLightShaft(source, destination, moonShaftsMaterial, simpleMoonClearMaterial, EnviroSkyMgr.instance.Components.Moon.transform, EnviroSkyMgr.instance.LightShaftsSettings.thresholdColorMoon.Evaluate(EnviroSkyMgr.instance.Time.solarTime), EnviroSkyMgr.instance.LightShaftsSettings.lightShaftsColorMoon.Evaluate(EnviroSkyMgr.instance.Time.solarTime));
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
}
|
||||
//////////////////////////////////////////////
|
||||
RenderTexture.ReleaseTemporary(tempTexture);
|
||||
}
|
||||
|
||||
void RenderLightShaft(RenderTexture source, RenderTexture destination, Material mat, Material clearMat, Transform lightSource, Color treshold, Color clr)
|
||||
{
|
||||
int divider = 4;
|
||||
if (EnviroSkyMgr.instance.LightShaftsSettings.resolution == SunShaftsResolution.Normal)
|
||||
divider = 2;
|
||||
else if (EnviroSkyMgr.instance.LightShaftsSettings.resolution == SunShaftsResolution.High)
|
||||
divider = 1;
|
||||
|
||||
Vector3 v = Vector3.one * 0.5f;
|
||||
|
||||
if (lightSource)
|
||||
v = cam.WorldToViewportPoint(lightSource.position);
|
||||
else
|
||||
v = new Vector3(0.5f, 0.5f, 0.0f);
|
||||
|
||||
// int rtW = source.width / divider;
|
||||
// int rtH = source.height / divider;
|
||||
|
||||
RenderTexture lrColorB;
|
||||
RenderTexture lrDepthBuffer;
|
||||
|
||||
RenderTextureDescriptor descriptor = source.descriptor;
|
||||
descriptor.width = source.width / divider;
|
||||
descriptor.height = source.height / divider;
|
||||
|
||||
lrDepthBuffer = RenderTexture.GetTemporary(descriptor);
|
||||
|
||||
// mask out everything except the skybox
|
||||
// we have 2 methods, one of which requires depth buffer support, the other one is just comparing images
|
||||
|
||||
mat.SetVector("_BlurRadius4", new Vector4(1.0f, 1.0f, 0.0f, 0.0f) * EnviroSkyMgr.instance.LightShaftsSettings.blurRadius);
|
||||
mat.SetVector("_SunPosition", new Vector4(v.x, v.y, v.z, EnviroSkyMgr.instance.LightShaftsSettings.maxRadius));
|
||||
mat.SetVector("_SunThreshold", treshold);
|
||||
|
||||
if (!EnviroSkyMgr.instance.LightShaftsSettings.useDepthTexture)
|
||||
{
|
||||
// var format = EnviroSkyMgr.instance.Camera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
|
||||
RenderTexture tmpBuffer = RenderTexture.GetTemporary(source.descriptor);
|
||||
RenderTexture.active = tmpBuffer;
|
||||
GL.ClearWithSkybox(false, cam);
|
||||
|
||||
mat.SetTexture("_Skybox", tmpBuffer);
|
||||
Graphics.Blit(source, lrDepthBuffer, mat, 3);
|
||||
RenderTexture.ReleaseTemporary(tmpBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source, lrDepthBuffer, mat, 2);
|
||||
}
|
||||
|
||||
// paint a small black small border to get rid of clamping problems
|
||||
if (cam.stereoActiveEye == Camera.MonoOrStereoscopicEye.Mono)
|
||||
DrawBorder(lrDepthBuffer, clearMat);
|
||||
|
||||
// radial blur:
|
||||
|
||||
radialBlurIterations = Mathf.Clamp(radialBlurIterations, 1, 4);
|
||||
|
||||
float ofs = EnviroSkyMgr.instance.LightShaftsSettings.blurRadius * (1.0f / 768.0f);
|
||||
|
||||
mat.SetVector("_BlurRadius4", new Vector4(ofs, ofs, 0.0f, 0.0f));
|
||||
mat.SetVector("_SunPosition", new Vector4(v.x, v.y, v.z, EnviroSkyMgr.instance.LightShaftsSettings.maxRadius));
|
||||
|
||||
for (int it2 = 0; it2 < radialBlurIterations; it2++)
|
||||
{
|
||||
// each iteration takes 2 * 6 samples
|
||||
// we update _BlurRadius each time to cheaply get a very smooth look
|
||||
lrColorB = RenderTexture.GetTemporary(descriptor);
|
||||
Graphics.Blit(lrDepthBuffer, lrColorB, mat, 1);
|
||||
RenderTexture.ReleaseTemporary(lrDepthBuffer);
|
||||
ofs = EnviroSkyMgr.instance.LightShaftsSettings.blurRadius * (((it2 * 2.0f + 1.0f) * 6.0f)) / 768.0f;
|
||||
mat.SetVector("_BlurRadius4", new Vector4(ofs, ofs, 0.0f, 0.0f));
|
||||
|
||||
lrDepthBuffer = RenderTexture.GetTemporary(descriptor);
|
||||
|
||||
Graphics.Blit(lrColorB, lrDepthBuffer, mat, 1);
|
||||
RenderTexture.ReleaseTemporary(lrColorB);
|
||||
ofs = EnviroSkyMgr.instance.LightShaftsSettings.blurRadius * (((it2 * 2.0f + 2.0f) * 6.0f)) / 768.0f;
|
||||
mat.SetVector("_BlurRadius4", new Vector4(ofs, ofs, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
// put together:
|
||||
|
||||
if (v.z >= 0.0f)
|
||||
mat.SetVector("_SunColor", new Vector4(clr.r, clr.g, clr.b, clr.a) * EnviroSkyMgr.instance.LightShaftsSettings.intensity);
|
||||
else
|
||||
mat.SetVector("_SunColor", Vector4.zero); // no backprojection !
|
||||
|
||||
mat.SetTexture("_ColorBuffer", lrDepthBuffer);
|
||||
|
||||
Graphics.Blit(source, destination, mat, (EnviroSkyMgr.instance.LightShaftsSettings.screenBlendMode == ShaftsScreenBlendMode.Screen) ? 0 : 4);
|
||||
RenderTexture.ReleaseTemporary(lrDepthBuffer);
|
||||
}
|
||||
|
||||
|
||||
void DrawBorder(RenderTexture dest, Material material)
|
||||
{
|
||||
float x1;
|
||||
float x2;
|
||||
float y1;
|
||||
float y2;
|
||||
|
||||
RenderTexture.active = dest;
|
||||
bool invertY = true; // source.texelSize.y < 0.0ff;
|
||||
// Set up the simple Matrix
|
||||
GL.PushMatrix();
|
||||
GL.LoadOrtho();
|
||||
|
||||
for (int i = 0; i < material.passCount; i++)
|
||||
{
|
||||
material.SetPass(i);
|
||||
|
||||
float y1_; float y2_;
|
||||
if (invertY)
|
||||
{
|
||||
y1_ = 1.0f; y2_ = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
y1_ = 0.0f; y2_ = 1.0f;
|
||||
}
|
||||
|
||||
// left
|
||||
x1 = 0.0f;
|
||||
x2 = 0.0f + 1.0f / (dest.width * 1.0f);
|
||||
y1 = 0.0f;
|
||||
y2 = 1.0f;
|
||||
GL.Begin(GL.QUADS);
|
||||
|
||||
GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
|
||||
GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
|
||||
|
||||
// right
|
||||
x1 = 1.0f - 1.0f / (dest.width * 1.0f);
|
||||
x2 = 1.0f;
|
||||
y1 = 0.0f;
|
||||
y2 = 1.0f;
|
||||
|
||||
GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
|
||||
GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
|
||||
|
||||
// top
|
||||
x1 = 0.0f;
|
||||
x2 = 1.0f;
|
||||
y1 = 0.0f;
|
||||
y2 = 0.0f + 1.0f / (dest.height * 1.0f);
|
||||
|
||||
GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
|
||||
GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
|
||||
|
||||
// bottom
|
||||
x1 = 0.0f;
|
||||
x2 = 1.0f;
|
||||
y1 = 1.0f - 1.0f / (dest.height * 1.0f);
|
||||
y2 = 1.0f;
|
||||
|
||||
GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f);
|
||||
GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f);
|
||||
GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f);
|
||||
|
||||
GL.End();
|
||||
}
|
||||
|
||||
GL.PopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f89b6d3142b38d9409bf73b28187f9fa
|
||||
timeCreated: 1541008405
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a46cbe4c734a4ed44a3fbbb7cc8f59c5
|
||||
timeCreated: 1532135788
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user