using UnityEngine; namespace Artngame.SKYMASTER { public class SKYMASTER_Demo3 : MonoBehaviour { public Transform target; public float damping = 6f; public bool smooth = true; private bool enable_lookat = true; private Circle_Around_ParticleSKYMASTER Sun_rotator; private Circle_Around_ParticleSKYMASTER Cam_rotator; private MouseLookSKYMASTER MouseLOOK; 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; private float Cloud_bed_height; private float Cloud_bed_width; private GameObject Cloud_instance; private float cloud_max_scale; private int cloud_max_particle_size; private bool Rot_clouds; private void Start() { Sun_rotator = SUN.GetComponent(typeof(Circle_Around_ParticleSKYMASTER)) as Circle_Around_ParticleSKYMASTER; Cam_rotator = Camera.main.gameObject.GetComponent(typeof(Circle_Around_ParticleSKYMASTER)) as Circle_Around_ParticleSKYMASTER; MouseLOOK = Camera.main.gameObject.GetComponent(typeof(MouseLookSKYMASTER)) as MouseLookSKYMASTER; Cloud_instance = Object.Instantiate(Clouds_top.gameObject); Cloud_instance.SetActive(value: true); Clouds_ORIGIN = Clouds_top.gameObject.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM; 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"); } } private void LateUpdate() { if (MouseLOOK.enabled) { enable_lookat = false; } else { enable_lookat = true; } if ((bool)target & enable_lookat) { if (smooth) { Quaternion b = Quaternion.LookRotation(target.position - base.transform.position); base.transform.rotation = Quaternion.Slerp(base.transform.rotation, b, Time.deltaTime * damping); } else { base.transform.LookAt(target); } } 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() { SunLight = SUN.GetComponent(); float num = 100f; float num2 = 30f; float num3 = 0f; float num4 = 10f; float num5 = Screen.currentResolution.width; num5 = Camera.main.pixelWidth; if (GUI.Button(new Rect(0f * num + 10f, num2 - 30f, num + 20f, 30f), "Recreate")) { Object.Destroy(Cloud_instance); 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; Cloud_instance = Object.Instantiate(Clouds_top.gameObject); Cloud_instance.SetActive(value: true); Clouds = Cloud_instance.GetComponent(typeof(VolumeClouds_SM)) as VolumeClouds_SM; } GUI.TextArea(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f - 30f, 180f, 30f), "Cloud Centers = " + Clouds_ORIGIN.divider); Cloud_divider = (int)GUI.HorizontalSlider(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f, 100f, 30f), Clouds_ORIGIN.divider, 2f, 45f); GUI.TextArea(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f - 30f - 60f, 180f, 30f), "Cloud Bed size = " + Clouds_ORIGIN.max_bed_corner); Cloud_bed_width = GUI.HorizontalSlider(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f - 60f, 100f, 30f), Clouds_ORIGIN.max_bed_corner, 300f, 1500f); GUI.TextArea(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f - 30f - 60f - 60f, 180f, 30f), "Cloud Bed Height = " + Clouds_ORIGIN.cloud_bed_heigh); Cloud_bed_height = GUI.HorizontalSlider(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f - 60f - 60f, 100f, 30f), Clouds_ORIGIN.cloud_bed_heigh, 500f, 1000f); GUI.TextArea(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f + 30f, 180f, 30f), "Cloud Max size = " + Clouds_ORIGIN.cloud_max_scale); cloud_max_scale = GUI.HorizontalSlider(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f + 30f + 30f, 100f, 30f), Clouds_ORIGIN.cloud_max_scale, 1f, 4f); GUI.TextArea(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f + 30f + 30f + 30f + 30f + 30f, 170f, 40f), "Recreate button will renew the clouds"); if (GUI.Button(new Rect(num5 - (num3 + 165f), 0f * num4 + 140f + 7f + 30f + 30f + 30f + 40f + 60f, 170f, 40f), "Rotate Clouds")) { if (Rot_clouds) { Rot_clouds = false; } else { Rot_clouds = 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; if (GUI.Button(new Rect(0f * num + 10f, num2 - 0f, num + 20f, 30f), "Rotate Camera")) { if (!Cam_rotator.enabled) { Cam_rotator.enabled = true; } else { Cam_rotator.enabled = false; } } if (GUI.Button(new Rect(0f * num + 10f, num2 + 30f, num + 20f, 30f), "Rotate Sun")) { if (!Sun_rotator.enabled) { Sun_rotator.enabled = true; } else { Sun_rotator.enabled = false; } } GUI.TextArea(new Rect(0f * num + 10f, 2f * num2 + 30f, num + 10f, 25f), "Camera up/down"); Camera_up = GUI.VerticalSlider(new Rect(0f * num + 10f, 2f * num2 + 30f + 30f, 30f, num + 10f), Camera.main.transform.position.y, -1300f, 1360f); Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera_up, Camera.main.transform.position.z); GUI.TextArea(new Rect(0f * num + 10f, 7f * num2 + 30f, num + 10f, 25f), "Sun up/down"); Sun_up = GUI.VerticalSlider(new Rect(1f * num + 10f, 2f * num2 + 30f + 30f, 30f, num + 10f), SUN.position.y, -1500f, 1500f); SUN.position = new Vector3(SUN.position.x, Sun_up, SUN.position.z); } } }