Files
UltimateFishing2020/Assets/Scripts/Assembly-CSharp/ARTNGAME/Skymaster/SKYMASTER_Volume_Clouds_Demo125.cs
2026-03-04 10:03:45 +08:00

249 lines
8.4 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace Artngame.SKYMASTER
{
public class SKYMASTER_Volume_Clouds_Demo125 : MonoBehaviour
{
private VolumeClouds_SM Clouds;
private VolumeClouds_SM Clouds_ORIGIN;
private Light SunLight;
public float Sun_time_start = 14.43f;
public Transform SUN;
public bool HUD_ON = true;
public Transform Clouds_top;
private float Dome_rot;
private float SunLight_r;
private float SunLight_g;
private float SunLight_b;
private float Camera_up;
private float Sun_up;
private float sun_rot_speed;
private float cam_rot_speed;
private int Cloud_divider = 45;
private float Cloud_bed_height;
private float Cloud_bed_width;
private GameObject Cloud_instance;
private float cloud_max_scale = 4f;
private int cloud_max_particle_size = 300;
private float cloud_X_speed;
private float cloud_Z_speed;
private bool Plus_hit;
private bool Rot_clouds;
public List<Transform> CloudPresets;
private int count_presets;
private bool Alt_color;
public SunShaftsSkyMaster Shafts;
public GlobalFogSkyMaster Fog;
private void Start()
{
Cloud_instance = Object.Instantiate(Clouds_top.gameObject, Clouds_top.transform.position, Quaternion.identity);
Cloud_instance.SetActive(value: true);
Clouds_ORIGIN = Clouds_top.gameObject.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
Clouds_ORIGIN.divider = Cloud_divider;
Clouds_ORIGIN.cloud_max_scale = cloud_max_scale;
Cloud_instance.SetActive(value: false);
Cloud_instance.SetActive(value: true);
if (Cloud_instance != null)
{
Clouds = Cloud_instance.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
}
else
{
Debug.Log("AAA");
}
if (Clouds != null)
{
cloud_X_speed = Clouds.wind.x;
cloud_Z_speed = Clouds.wind.z;
}
}
private void LateUpdate()
{
if (Rot_clouds)
{
if (Clouds != null)
{
Clouds.wind.x = 2f * Mathf.Cos(Time.fixedTime * 0.1f);
Clouds.wind.z = 2f * Mathf.Sin(Time.fixedTime * 0.1f);
Clouds.speed = 2f;
Clouds.multiplier = 2f;
}
}
else
{
Clouds.speed = 0.5f;
Clouds.multiplier = 1f;
}
}
private void OnGUI()
{
float num = 0f;
float num2 = 10f;
float num3 = Screen.currentResolution.width;
num3 = Camera.main.pixelWidth;
GUI.TextArea(new Rect(num3 - (num + 165f) - 0f, -20f + 0f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f + 40f, 120f, 20f), "Cloud Type: " + (count_presets + 1) + "/" + CloudPresets.Count);
if (GUI.Button(new Rect(125f + num3 - (num + 165f) - 0f, -20f + 0f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f + 40f, 20f, 20f), "+"))
{
count_presets++;
if (count_presets > CloudPresets.Count - 1)
{
count_presets = 0;
}
if (CloudPresets[count_presets] != Clouds_top)
{
Clouds_top = CloudPresets[count_presets];
Clouds_ORIGIN = Clouds_top.gameObject.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
Cloud_bed_width = Clouds_ORIGIN.max_bed_corner;
Cloud_bed_height = Clouds_ORIGIN.cloud_bed_heigh;
Cloud_divider = Clouds_ORIGIN.divider;
cloud_max_scale = Clouds_ORIGIN.cloud_max_scale;
}
Plus_hit = true;
}
if (GUI.Button(new Rect(145f + num3 - (num + 165f) - 0f, -20f + 0f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f + 40f, 20f, 20f), "-"))
{
count_presets--;
if (count_presets < 0)
{
count_presets = CloudPresets.Count - 1;
}
if (CloudPresets[count_presets] != Clouds_top)
{
Clouds_top = CloudPresets[count_presets];
Clouds_ORIGIN = Clouds_top.gameObject.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
Cloud_bed_width = Clouds_ORIGIN.max_bed_corner;
Cloud_bed_height = Clouds_ORIGIN.cloud_bed_heigh;
Cloud_divider = Clouds_ORIGIN.divider;
cloud_max_scale = Clouds_ORIGIN.cloud_max_scale;
}
Plus_hit = true;
}
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 10f + 20f, 50f, 20f), "Clear");
if (GUI.Button(new Rect(num3 - (num + 165f) + 50f, 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 10f + 20f, 50f, 20f), "Clouds"))
{
Object.Destroy(Cloud_instance);
}
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 10f, 50f, 20f), "Toggle");
if (GUI.Button(new Rect(num3 - (num + 165f) + 50f, 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 10f, 50f, 20f), "Haze"))
{
if (Fog.enabled)
{
Fog.enabled = false;
}
else
{
Fog.enabled = true;
}
}
if (GUI.Button(new Rect(num3 - (num + 165f) + 50f + 50f, 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 10f, 50f, 20f), "Shafts"))
{
if (Shafts.enabled)
{
Shafts.enabled = false;
}
else
{
Shafts.enabled = true;
}
}
if (GUI.Button(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f + 40f, 170f, 40f), "Recreate Clouds") | Plus_hit)
{
Object.Destroy(Cloud_instance);
Plus_hit = false;
Clouds_ORIGIN = Clouds_top.gameObject.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
Clouds_ORIGIN.max_bed_corner = Cloud_bed_width;
Clouds_ORIGIN.min_bed_corner = 0f;
Clouds_ORIGIN.cloud_bed_heigh = Cloud_bed_height;
Clouds_ORIGIN.divider = Cloud_divider;
Clouds_ORIGIN.cloud_max_scale = cloud_max_scale;
Cloud_instance = Object.Instantiate(Clouds_top.gameObject, Clouds_top.transform.position, Quaternion.identity);
Cloud_instance.SetActive(value: true);
Clouds = Cloud_instance.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM;
if (Alt_color)
{
Clouds.Override_init_color = true;
}
}
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 30f - 15f - 15f, 180f, 25f), "Cloud Centers = " + Clouds_ORIGIN.divider);
Cloud_divider = (int)GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 15f - 15f, 100f, 30f), Clouds_ORIGIN.divider, 2f, 85f);
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 30f - 60f - 15f, 180f, 25f), "Cloud Bed size = " + Clouds_ORIGIN.max_bed_corner);
Cloud_bed_width = GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 60f - 15f, 100f, 30f), Clouds_ORIGIN.max_bed_corner, 300f, 8900f);
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 30f - 60f - 60f, 180f, 25f), "Cloud Bed Height = " + Clouds_ORIGIN.cloud_bed_heigh);
Cloud_bed_height = GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f - 60f - 60f - 0f, 100f, 30f), Clouds_ORIGIN.cloud_bed_heigh, 50f, 1000f);
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f - 15f - 15f - 15f, 180f, 25f), "Cloud Max size = " + Clouds_ORIGIN.cloud_max_scale);
cloud_max_scale = GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f - 15f - 15f - 15f, 100f, 30f), Clouds_ORIGIN.cloud_max_scale, 1f, 8f);
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f - 15f - 15f - 15f - 15f + 20f + 22f, 180f, 22f), "Cloud speed");
cloud_X_speed = (int)GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f - 15f - 15f - 15f - 15f + 35f + 2f, 100f, 20f), Clouds.wind.x, -70f, 70f);
Clouds.wind.x = cloud_X_speed;
cloud_Z_speed = (int)GUI.HorizontalSlider(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f - 15f - 15f - 15f - 15f + 25f + 35f, 100f, 20f), Clouds.wind.z, -70f, 70f);
Clouds.wind.z = cloud_Z_speed;
GUI.TextArea(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 30f + 30f + 20f, 170f, 20f), "Recreate renews the clouds");
if (GUI.Button(new Rect(num3 - (num + 165f), 0f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f, 170f, 20f), "Rotate Clouds"))
{
if (Rot_clouds)
{
Rot_clouds = false;
}
else
{
Rot_clouds = true;
}
}
string text = "Alt color";
if (Alt_color)
{
text = "Prev color";
}
if (GUI.Button(new Rect(num3 - (num + 165f), 8f * num2 + 140f + 7f + 30f + 30f + 30f + 40f + 60f, 170f, 40f), text))
{
if (Alt_color)
{
Alt_color = false;
}
else
{
Alt_color = true;
}
}
Clouds_ORIGIN.max_bed_corner = Cloud_bed_width;
Clouds_ORIGIN.min_bed_corner = 0f - Cloud_bed_width;
Clouds_ORIGIN.cloud_bed_heigh = Cloud_bed_height;
Clouds_ORIGIN.divider = Cloud_divider;
Clouds_ORIGIN.cloud_max_scale = cloud_max_scale;
}
}
}