177 lines
5.7 KiB
C#
177 lines
5.7 KiB
C#
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER
|
|
{
|
|
public class SKYMASTER_DemoV30_AIRPLANE : MonoBehaviour
|
|
{
|
|
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 int windowsON;
|
|
|
|
public Transform planeVIEW;
|
|
|
|
public Transform backVIEW;
|
|
|
|
private bool inPlane;
|
|
|
|
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;
|
|
Dome_rot = SUNMASTER.Rot_Sun_Y;
|
|
}
|
|
|
|
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 (SUNMASTER.currentWeather != null && SUNMASTER.currentWeather.VolumeCloud != null)
|
|
{
|
|
if (GUI.Button(new Rect(7f * (num + num3) + 30f, 0f, num + 60f, 22f), "Cycle cloud materials(" + (cloud_mat_counter + 1) + ")"))
|
|
{
|
|
if (cloud_mat_counter == 0)
|
|
{
|
|
SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material = CloudMat1;
|
|
SUNMASTER.currentWeather.VolumeScript.ScatterMat = SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material;
|
|
}
|
|
else if (cloud_mat_counter == 1)
|
|
{
|
|
SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material = CloudMat2;
|
|
SUNMASTER.currentWeather.VolumeScript.ScatterMat = SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material;
|
|
}
|
|
else if (cloud_mat_counter == 2)
|
|
{
|
|
SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material = CloudMat3;
|
|
SUNMASTER.currentWeather.VolumeScript.ScatterMat = SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material;
|
|
}
|
|
else if (cloud_mat_counter == 3)
|
|
{
|
|
SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material = CloudMat4;
|
|
SUNMASTER.currentWeather.VolumeScript.ScatterMat = SUNMASTER.currentWeather.VolumeCloud.GetComponent<Renderer>().material;
|
|
}
|
|
cloud_mat_counter++;
|
|
}
|
|
if (cloud_mat_counter > 3)
|
|
{
|
|
cloud_mat_counter = 0;
|
|
}
|
|
}
|
|
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.01f, 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);
|
|
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), "SkyDome rot");
|
|
Dome_rot = GUI.HorizontalSlider(new Rect(2f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), Dome_rot, 0f, 360f);
|
|
SUNMASTER.Rot_Sun_Y = Dome_rot;
|
|
GUI.TextArea(new Rect(3f * (num + num3), 1f * num2, num + 0f, 20f), "Wind direction");
|
|
float y = GUI.HorizontalSlider(new Rect(3f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), SUNMASTER.windZone.transform.eulerAngles.y, 0f, 360f);
|
|
Vector3 eulerAngles = SUNMASTER.windZone.gameObject.transform.eulerAngles;
|
|
SUNMASTER.windZone.gameObject.transform.eulerAngles = new Vector3(eulerAngles.x, y, eulerAngles.z);
|
|
GUI.TextArea(new Rect(4f * (num + num3), 1f * num2, num + 0f, 20f), "Wind intensity");
|
|
SUNMASTER.windZone.windMain = GUI.HorizontalSlider(new Rect(4f * (num + num3), 1f * num2 + 25f, num + 0f, 30f), SUNMASTER.windZone.windMain, 0f, 24f);
|
|
GUI.TextArea(new Rect(1f * (num + num3), 1f * num2, num, 20f), "Time of Day");
|
|
TOD = GUI.HorizontalSlider(new Rect(1f * (num + num3), 1f * num2 + 25f, num, 20f), SUNMASTER.Current_Time, 0f, 24f);
|
|
SUNMASTER.Current_Time = TOD;
|
|
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), "Heavy Storm"))
|
|
{
|
|
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.HeavyStorm;
|
|
}
|
|
if (GUI.Button(new Rect(5f * (num + num3), 0f, num, 22f), "Rain"))
|
|
{
|
|
SUNMASTER.currentWeatherName = SkyMasterManager.Volume_Weather_types.Rain;
|
|
}
|
|
}
|
|
_ = SPEED;
|
|
_ = 1f;
|
|
if ((SUNMASTER.Current_Time != Sun_time_start) & !set_sun_start)
|
|
{
|
|
set_sun_start = true;
|
|
}
|
|
}
|
|
}
|
|
}
|