235 lines
9.2 KiB
C#
235 lines
9.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER
|
|
{
|
|
public class SKYMASTER_DemoV33_MOBILE : MonoBehaviour
|
|
{
|
|
public bool offsetsON;
|
|
|
|
public bool colorsON;
|
|
|
|
public float Sun_time_start = 14.43f;
|
|
|
|
public GameObject SKYMASTER_OBJ;
|
|
|
|
private SkyMasterManager SUNMASTER;
|
|
|
|
public bool HUD_ON = true;
|
|
|
|
private bool set_sun_start;
|
|
|
|
public Material CloudMat1;
|
|
|
|
public Material CloudMat2;
|
|
|
|
public Material CloudMat3;
|
|
|
|
public Material CloudMat4;
|
|
|
|
private int cloud_mat_counter;
|
|
|
|
private float Dome_rot;
|
|
|
|
private float Camera_up;
|
|
|
|
private float TOD;
|
|
|
|
private float SPEED;
|
|
|
|
private WaterHeightSM WaterHeightHandle;
|
|
|
|
private WaterHandlerSM WaterHandler;
|
|
|
|
private int windowsON;
|
|
|
|
public Transform planeVIEW;
|
|
|
|
public Transform backVIEW;
|
|
|
|
private bool inPlane;
|
|
|
|
public Material SnowMat;
|
|
|
|
private int sky_preset = 11;
|
|
|
|
private void Start()
|
|
{
|
|
if (SKYMASTER_OBJ != null)
|
|
{
|
|
SUNMASTER = SKYMASTER_OBJ.GetComponent(typeof(SkyMasterManager)) as SkyMasterManager;
|
|
}
|
|
SPEED = SUNMASTER.SPEED;
|
|
SUNMASTER.Seasonal_change_auto = false;
|
|
TOD = SUNMASTER.Current_Time;
|
|
WaterHeightHandle = SUNMASTER.water.gameObject.GetComponent<WaterHeightSM>();
|
|
WaterHandler = SUNMASTER.water.gameObject.GetComponent<WaterHandlerSM>();
|
|
Dome_rot = SUNMASTER.Rot_Sun_Y;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (SUNMASTER.Rot_Sun_X > 0f)
|
|
{
|
|
SUNMASTER.Mesh_Terrain_controller.fog_depth = Mathf.Lerp(SUNMASTER.Mesh_Terrain_controller.fog_depth, 7f, Time.deltaTime);
|
|
SUNMASTER.Mesh_Terrain_controller.ExposureBias = Mathf.Lerp(SUNMASTER.Mesh_Terrain_controller.ExposureBias, 0.02f, Time.deltaTime);
|
|
}
|
|
else
|
|
{
|
|
SUNMASTER.Mesh_Terrain_controller.fog_depth = Mathf.Lerp(SUNMASTER.Mesh_Terrain_controller.fog_depth, 0f, Time.deltaTime);
|
|
SUNMASTER.Mesh_Terrain_controller.ExposureBias = Mathf.Lerp(SUNMASTER.Mesh_Terrain_controller.ExposureBias, 0.002f, Time.deltaTime);
|
|
}
|
|
}
|
|
|
|
private void OnGUI()
|
|
{
|
|
float num = 100f;
|
|
float num2 = 30f;
|
|
string text = "Disable HUD";
|
|
if (!HUD_ON)
|
|
{
|
|
text = "Enable HUD";
|
|
}
|
|
if (GUI.Button(new Rect(2f, 0f * num2, num - 2f, 22f), text))
|
|
{
|
|
if (HUD_ON)
|
|
{
|
|
HUD_ON = false;
|
|
}
|
|
else
|
|
{
|
|
HUD_ON = true;
|
|
}
|
|
}
|
|
float num3 = 5f;
|
|
if (GUI.Button(new Rect(1f * num + 5f, 0f * num2, num - 2f, 22f), "Eclipse"))
|
|
{
|
|
SUNMASTER.Latitude = -15f;
|
|
SUNMASTER.Longitude = 0f;
|
|
SUNMASTER.Current_Day = 120.1f;
|
|
}
|
|
if (!HUD_ON)
|
|
{
|
|
return;
|
|
}
|
|
GUI.TextArea(new Rect(2f, 1f * num2, 98f, 20f), "Sun Speed");
|
|
SPEED = GUI.HorizontalSlider(new Rect(2f, 1f * num2 + 25f, 98f, 30f), SPEED, 0.2f, 70f);
|
|
SUNMASTER.SPEED = SPEED;
|
|
GUI.TextArea(new Rect(2f, 1f * num2 + 50f, 98f, 20f), "Sun Intensity");
|
|
SUNMASTER.Max_sun_intensity = GUI.HorizontalSlider(new Rect(2f, 1f * num2 + 25f + 50f, 98f, 15f), SUNMASTER.Max_sun_intensity, 0.5f, 2.5f);
|
|
if (GUI.Button(new Rect(5f * (num + num3) + 0f, 0f, num + 50f, 22f), "Cycle sky presets:" + SUNMASTER.Preset))
|
|
{
|
|
if (SUNMASTER.Preset == 11)
|
|
{
|
|
SUNMASTER.Preset = 0;
|
|
}
|
|
else
|
|
{
|
|
SUNMASTER.Preset = 11;
|
|
}
|
|
}
|
|
if (SnowMat != null)
|
|
{
|
|
GUI.TextArea(new Rect(2f, 4f * num2 + 0f, 98f, 20f), "Terrain cover");
|
|
SUNMASTER.SnowCoverage = GUI.HorizontalSlider(new Rect(2f, 4f * num2 + 25f, 98f, 15f), SUNMASTER.SnowCoverage, 0f, 3.5f);
|
|
}
|
|
GUI.TextArea(new Rect(1f * (num + num3), 1f * num2 + 50f, 98f, 20f), "Sky ambience");
|
|
SUNMASTER.SkyColorationOffset = GUI.HorizontalSlider(new Rect(1f * (num + num3), 1f * num2 + 25f + 50f, 98f, 15f), SUNMASTER.SkyColorationOffset, -0.4f, 0.4f);
|
|
GUI.TextArea(new Rect(1f * (num + num3), 4f * num2 + 0f, 98f, 20f), "Cloud glow");
|
|
SUNMASTER.L1Ambience = GUI.HorizontalSlider(new Rect(1f * (num + num3), 4f * num2 + 25f, 98f, 15f), SUNMASTER.L1Ambience, 0f, 1.2f);
|
|
GUI.TextArea(new Rect(1f * (num + num3), 5f * num2 + 10f, 98f, 20f), "Cloud size");
|
|
SUNMASTER.L1CloudSize = GUI.HorizontalSlider(new Rect(1f * (num + num3), 5f * num2 + 25f + 10f, 98f, 15f), SUNMASTER.L1CloudSize, 0f, 2f);
|
|
GUI.TextArea(new Rect(2f * (num + num3), 5f * num2 + 10f, 98f, 20f), "Cloud cover");
|
|
SUNMASTER.L1CloudCoverOffset = GUI.HorizontalSlider(new Rect(2f * (num + num3), 5f * num2 + 25f + 10f, 98f, 15f), SUNMASTER.L1CloudCoverOffset, 0f, 0.2f);
|
|
string text2 = "Front of Plane View";
|
|
if (inPlane)
|
|
{
|
|
text2 = "Behind Plane View";
|
|
}
|
|
if (planeVIEW != null && GUI.Button(new Rect(6f * (num + num3) + 0f, 0f, num + 30f, 22f), text2))
|
|
{
|
|
if (inPlane)
|
|
{
|
|
inPlane = false;
|
|
Camera.main.transform.parent = backVIEW;
|
|
Camera.main.transform.localPosition = new Vector3(0f, 12f, 0f);
|
|
}
|
|
else
|
|
{
|
|
inPlane = true;
|
|
Camera.main.transform.parent = planeVIEW;
|
|
Camera.main.transform.forward = planeVIEW.forward;
|
|
Camera.main.transform.localPosition = new Vector3(0f, 17f, -19f);
|
|
}
|
|
}
|
|
GUI.TextArea(new Rect(2f * (num + num3), 1f * num2, num + 0f, 20f), "Latitude=" + SUNMASTER.Latitude);
|
|
SUNMASTER.Latitude = GUI.HorizontalSlider(new Rect(2f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), SUNMASTER.Latitude, -89.99f, 89.99f);
|
|
GUI.TextArea(new Rect(2f * (num + num3), 1f * num2 + 50f, num + 0f, 20f), "Longitude=" + SUNMASTER.Longitude);
|
|
SUNMASTER.Longitude = GUI.HorizontalSlider(new Rect(2f * (num + num3), 1f * num2 + 50f + 25f, num + 0f, 30f), SUNMASTER.Longitude, -180f, 180f);
|
|
GUI.TextArea(new Rect(2f * (num + num3), 4f * num2, num + 0f, 20f), "Moon size");
|
|
SUNMASTER.MoonSize = GUI.HorizontalSlider(new Rect(2f * (num + num3), 4f * num2 + 25f, num + 0f, 30f), SUNMASTER.MoonSize, 0.035f, 5f);
|
|
GUI.TextArea(new Rect(3f * (num + num3), 1f * num2 + 0f, 365f, 20f), "Day=" + SUNMASTER.Current_Day);
|
|
SUNMASTER.Current_Day = GUI.HorizontalSlider(new Rect(3f * (num + num3), 1f * num2 + 25f, 365f, 30f), SUNMASTER.Current_Day, 0f, 365f);
|
|
GUI.TextArea(new Rect(1f * (num + num3), 1f * num2, num, 20f), "Time (" + SUNMASTER.Current_Time.ToString("F2") + ")");
|
|
TOD = GUI.HorizontalSlider(new Rect(1f * (num + num3), 1f * num2 + 25f, num, 20f), SUNMASTER.Current_Time, 0f, 24f);
|
|
SUNMASTER.Current_Time = TOD;
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f, num, 20f), "Wave height");
|
|
WaterHandler.waterScaleOffset.y = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f, num, 20f), WaterHandler.waterScaleOffset.y, 0f, 3f);
|
|
GUI.TextArea(new Rect(4f * (num + num3), 1f * num2 + 50f + 0f, num, 20f), "Boat Speed");
|
|
WaterHeightHandle.BoatSpeed = GUI.HorizontalSlider(new Rect(4f * (num + num3), 1f * num2 + 25f + 50f + 0f, num, 20f), WaterHeightHandle.BoatSpeed, 0.3f, 5f);
|
|
if (GUI.Button(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f, num, 20f), "Reset water"))
|
|
{
|
|
WaterHandler.FresnelOffset = 0f;
|
|
WaterHandler.FresnelBias = 0f;
|
|
WaterHandler.BumpFocusOffset = 0f;
|
|
WaterHandler.DepthColorOffset = 0f;
|
|
WaterHandler.ShoreBlendOffset = 0f;
|
|
}
|
|
if (GUI.Button(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 25f, num, 20f), "Water controls"))
|
|
{
|
|
if (offsetsON)
|
|
{
|
|
offsetsON = false;
|
|
}
|
|
else
|
|
{
|
|
offsetsON = true;
|
|
}
|
|
}
|
|
if (offsetsON)
|
|
{
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 50f, num * 1f, 20f), "Fresnel Power");
|
|
WaterHandler.FresnelOffset = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f + 50f + 50f, num * 3f, 20f), WaterHandler.FresnelOffset, -0.5f, 1.7905f);
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 100f, num * 1f, 20f), "Foam");
|
|
WaterHandler.FoamOffset = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f + 50f + 100f, num * 3f, 20f), WaterHandler.FoamOffset, 0f, 24f);
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 150f, num * 1f, 20f), "Specular focus");
|
|
WaterHandler.BumpFocusOffset = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f + 50f + 150f, num * 3f, 20f), WaterHandler.BumpFocusOffset, -4f, 4f);
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 200f, num * 1f, 20f), "Depth Offset");
|
|
WaterHandler.ShoreBlendOffset = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f + 50f + 200f, num * 3f, 20f), WaterHandler.ShoreBlendOffset, -0.155f, 0.1f);
|
|
GUI.TextArea(new Rect(5f * (num + num3), 1f * num2 + 50f + 50f + 250f, num * 1f, 20f), "Depth FX");
|
|
WaterHandler.DepthColorOffset = GUI.HorizontalSlider(new Rect(5f * (num + num3), 1f * num2 + 25f + 50f + 50f + 250f, num * 3f, 20f), WaterHandler.DepthColorOffset, -140f, 10f);
|
|
}
|
|
if ((SUNMASTER.currentWeather != null && SUNMASTER.currentWeather.currentState != WeatherSM.Volume_Weather_State.FadeIn) | (SUNMASTER.currentWeather == null))
|
|
{
|
|
if (GUI.Button(new Rect(2f * (num + num3), 0f, num, 22f), "Cloudy"))
|
|
{
|
|
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.Cloudy;
|
|
}
|
|
if (GUI.Button(new Rect(3f * (num + num3), 0f, num, 22f), "Snow"))
|
|
{
|
|
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.SnowStorm;
|
|
}
|
|
if (GUI.Button(new Rect(4f * (num + num3), 0f, num, 22f), "Rain"))
|
|
{
|
|
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.HeavyStorm;
|
|
}
|
|
}
|
|
_ = SPEED;
|
|
_ = 1f;
|
|
if ((SUNMASTER.Current_Time != Sun_time_start) & !set_sun_start)
|
|
{
|
|
set_sun_start = true;
|
|
}
|
|
}
|
|
}
|
|
}
|