Files
2026-03-04 10:03:45 +08:00

439 lines
13 KiB
C#

using UnityEngine;
namespace Artngame.GIPROXY
{
public class ControlGIPROXY_ATTRIUM1 : MonoBehaviour
{
private LightCollisionsPDM GI_PROXY_script;
private LightCollisionsPDM GI_PROXY_POINT_script;
private LightCollisionsPDM GI_PROXY_SPOT_script;
public GameObject LightPOOL;
public GameObject MainAtrium;
public GameObject WhiteAtrium;
private float intensity_current;
private float ambience_current;
private float rotation_current;
private float rotation_current_X;
private float position_current_Z;
public Transform LookAtTarget;
public Transform PointLight;
public Transform PointLight_POOL;
private Vector3 Initial_point_light_pos;
public Transform SpotLight;
public Transform SpotLight_POOL;
public Transform GUI_texts;
public Transform Procedural_sphere;
public Transform Intro_letters;
public Transform Intro_letters_GI;
public Transform Intro_letters_GI_POOL;
public Transform Tentacles;
public float intro_time = 5f;
private float current_time = 2f;
private bool intro_ended;
private bool enable_GUI = true;
private void Start()
{
GI_PROXY_script = base.gameObject.GetComponent(typeof(LightCollisionsPDM)) as LightCollisionsPDM;
if (PointLight != null)
{
PointLight.gameObject.SetActive(value: true);
GI_PROXY_POINT_script = PointLight.gameObject.GetComponentInChildren(typeof(LightCollisionsPDM)) as LightCollisionsPDM;
if (GI_PROXY_POINT_script != null)
{
PointLight.gameObject.SetActive(value: false);
}
}
if (SpotLight != null)
{
SpotLight.gameObject.SetActive(value: true);
GI_PROXY_SPOT_script = SpotLight.gameObject.GetComponentInChildren(typeof(LightCollisionsPDM)) as LightCollisionsPDM;
if (GI_PROXY_SPOT_script != null)
{
SpotLight.gameObject.SetActive(value: false);
}
}
Initial_point_light_pos = PointLight.transform.position;
}
private void OnGUI()
{
if (intro_ended)
{
string text = "off";
if (!enable_GUI)
{
text = "on";
}
if (GUI.Button(new Rect(0f, 100f, 110f, 40f), "Toggle GUI " + text))
{
if (!enable_GUI)
{
enable_GUI = true;
GUI_texts.gameObject.SetActive(value: true);
}
else
{
enable_GUI = false;
GUI_texts.gameObject.SetActive(value: false);
}
}
}
if (!(intro_ended & enable_GUI) || !(GI_PROXY_script != null))
{
return;
}
string text2 = "Toggle GI on";
if (GI_PROXY_script.enabled)
{
text2 = "Toggle GI off - " + GI_PROXY_script.Lights.Count + " Lights";
}
if (GUI.Button(new Rect(200f, 10f, 200f, 80f), text2))
{
if (GI_PROXY_script.enabled)
{
GI_PROXY_script.enabled = false;
LightPOOL.SetActive(value: false);
}
else
{
GI_PROXY_script.enabled = true;
LightPOOL.SetActive(value: true);
PointLight.gameObject.SetActive(value: false);
PointLight_POOL.gameObject.SetActive(value: false);
PointLight.gameObject.transform.position = Initial_point_light_pos;
GetComponent<Light>().enabled = true;
SpotLight.gameObject.SetActive(value: false);
SpotLight_POOL.gameObject.SetActive(value: false);
}
}
string text3 = "Toggle Spot GI on";
if (GI_PROXY_SPOT_script.enabled)
{
text3 = "Toggle Spot GI off - " + GI_PROXY_SPOT_script.Lights.Count + " Lights";
}
if (GUI.Button(new Rect(0f, 50f, 200f, 40f), text3))
{
if (GI_PROXY_SPOT_script.enabled)
{
GI_PROXY_SPOT_script.enabled = false;
SpotLight_POOL.gameObject.SetActive(value: false);
}
else
{
GI_PROXY_SPOT_script.enabled = true;
SpotLight_POOL.gameObject.SetActive(value: true);
GI_PROXY_script.enabled = false;
LightPOOL.SetActive(value: false);
GetComponent<Light>().enabled = false;
PointLight.gameObject.SetActive(value: false);
PointLight_POOL.gameObject.SetActive(value: false);
PointLight.gameObject.transform.position = Initial_point_light_pos;
GetComponent<Light>().enabled = false;
}
}
string text4 = "Toggle Point GI on";
if (GI_PROXY_POINT_script.enabled)
{
text4 = "Toggle Point GI off - " + GI_PROXY_POINT_script.Lights.Count + " Lights";
}
if (GUI.Button(new Rect(400f, 50f, 200f, 40f), text4))
{
if (GI_PROXY_POINT_script.enabled)
{
GI_PROXY_POINT_script.enabled = false;
PointLight_POOL.gameObject.SetActive(value: false);
}
else
{
GI_PROXY_POINT_script.enabled = true;
PointLight_POOL.gameObject.SetActive(value: true);
GI_PROXY_script.enabled = false;
LightPOOL.SetActive(value: false);
GetComponent<Light>().enabled = false;
SpotLight.gameObject.SetActive(value: false);
SpotLight_POOL.gameObject.SetActive(value: false);
}
}
GUI.TextArea(new Rect(0f, 132f, 200f, 25f), "Sun light");
intensity_current = GUI.HorizontalSlider(new Rect(0f, 160f, 200f, 30f), GetComponent<Light>().intensity, 0.2f, 0.65f);
GetComponent<Light>().intensity = intensity_current;
GUI.TextArea(new Rect(0f, 192f, 200f, 25f), "Ambient light");
ambience_current = GUI.HorizontalSlider(new Rect(0f, 220f, 200f, 30f), RenderSettings.ambientLight.r * 255f, 5f, 60f);
RenderSettings.ambientLight = new Color(ambience_current / 255f, ambience_current / 255f, ambience_current / 255f, RenderSettings.ambientLight.a);
GUI.TextArea(new Rect(0f, 252f, 200f, 25f), "Rotate Sun Horizontally");
rotation_current = GUI.HorizontalSlider(new Rect(0f, 280f, 200f, 30f), base.gameObject.transform.root.eulerAngles.y, 10f, 270f);
base.gameObject.transform.root.eulerAngles = new Vector3(base.gameObject.transform.root.eulerAngles.x, rotation_current, base.gameObject.transform.root.eulerAngles.z);
GUI.TextArea(new Rect(0f, 312f, 200f, 25f), "Rotate Sun Vertically");
rotation_current_X = GUI.HorizontalSlider(new Rect(0f, 340f, 200f, 30f), base.gameObject.transform.root.eulerAngles.x, 45f, 80f);
base.gameObject.transform.root.eulerAngles = new Vector3(rotation_current_X, base.gameObject.transform.root.eulerAngles.y, base.gameObject.transform.root.eulerAngles.z);
GUI.TextArea(new Rect(0f, 372f, 200f, 25f), "Move Point Light Vertically");
position_current_Z = GUI.HorizontalSlider(new Rect(0f, 400f, 200f, 30f), PointLight.transform.position.z, -45f, -2.5f);
PointLight.transform.position = new Vector3(PointLight.transform.position.x, PointLight.transform.position.y, position_current_Z);
string text5 = "Mount";
if (PointLight.gameObject.transform.root.gameObject == Procedural_sphere.gameObject)
{
text5 = "Dismount";
}
if (GI_PROXY_POINT_script.enabled && GUI.Button(new Rect(0f, 445f, 200f, 20f), text5 + " point light"))
{
if (PointLight.gameObject.transform.root.gameObject == Procedural_sphere.gameObject)
{
PointLight.localScale = 1.24f * Vector3.one;
PointLight.gameObject.transform.parent = null;
}
else
{
PointLight.gameObject.transform.parent = Procedural_sphere;
PointLight.localPosition = Vector3.zero;
PointLight.localScale = 1.7f * Vector3.one;
}
}
if (Tentacles != null && GUI.Button(new Rect(0f, 425f, 200f, 20f), "Toggle Tentacles"))
{
if (Tentacles.gameObject.activeInHierarchy)
{
Tentacles.gameObject.SetActive(value: false);
}
else
{
Tentacles.gameObject.SetActive(value: true);
}
}
if (GUI.Button(new Rect(0f, 465f, 200f, 20f), "Toggle Quality"))
{
if (QualitySettings.GetQualityLevel() == 4)
{
QualitySettings.IncreaseLevel(applyExpensiveChanges: false);
}
else
{
QualitySettings.DecreaseLevel(applyExpensiveChanges: false);
}
}
if (GUI.Button(new Rect(0f, 485f, 200f, 20f), "Toggle Atrium"))
{
if (MainAtrium.activeInHierarchy)
{
MainAtrium.SetActive(value: false);
WhiteAtrium.SetActive(value: true);
}
else
{
MainAtrium.SetActive(value: true);
WhiteAtrium.SetActive(value: false);
}
}
if (PointLight != null)
{
string text6 = "off";
if (GI_PROXY_script.enabled)
{
text6 = "on";
}
if (GUI.Button(new Rect(400f, 10f, 200f, 40f), "Toggle Point Light " + text6))
{
if (GI_PROXY_script.enabled)
{
GI_PROXY_script.enabled = false;
LightPOOL.SetActive(value: false);
PointLight.gameObject.SetActive(value: true);
PointLight_POOL.gameObject.SetActive(value: true);
PointLight.gameObject.transform.position = Initial_point_light_pos;
GetComponent<Light>().enabled = false;
SpotLight.gameObject.SetActive(value: false);
SpotLight_POOL.gameObject.SetActive(value: false);
}
else
{
GI_PROXY_script.enabled = true;
LightPOOL.SetActive(value: true);
PointLight.gameObject.SetActive(value: false);
PointLight_POOL.gameObject.SetActive(value: false);
PointLight.gameObject.transform.position = Initial_point_light_pos;
GetComponent<Light>().enabled = true;
}
}
}
if (SpotLight != null)
{
string text7 = "off";
if (!SpotLight.gameObject.activeInHierarchy)
{
text7 = "on";
}
if (GUI.Button(new Rect(0f, 10f, 200f, 40f), "Toggle Spot Light " + text7))
{
if (!SpotLight.gameObject.activeInHierarchy)
{
GI_PROXY_script.enabled = false;
LightPOOL.SetActive(value: false);
PointLight.gameObject.SetActive(value: false);
PointLight_POOL.gameObject.SetActive(value: false);
PointLight.gameObject.transform.position = Initial_point_light_pos;
GetComponent<Light>().enabled = false;
SpotLight.gameObject.SetActive(value: true);
SpotLight_POOL.gameObject.SetActive(value: true);
}
else
{
GetComponent<Light>().enabled = true;
SpotLight.gameObject.SetActive(value: false);
SpotLight_POOL.gameObject.SetActive(value: false);
}
}
}
string text8 = "high";
if (GI_PROXY_POINT_script.Degrade_speed == 0.14f)
{
text8 = "low";
}
if (PointLight != null && GUI.Button(new Rect(400f, 100f, 200f, 40f), "Toggle Point GI power " + text8))
{
for (int i = 0; i < GI_PROXY_POINT_script.Lights.Count; i++)
{
Object.Destroy(GI_PROXY_POINT_script.Lights[i].gameObject);
}
GI_PROXY_POINT_script.Lights.Clear();
if (GI_PROXY_POINT_script.Degrade_speed == 0.09f)
{
GI_PROXY_POINT_script.Degrade_speed = 0.14f;
}
else
{
GI_PROXY_POINT_script.Degrade_speed = 0.09f;
}
if (GI_PROXY_POINT_script.Appear_speed == 0.08f)
{
GI_PROXY_POINT_script.Appear_speed = 0.12f;
}
else
{
GI_PROXY_POINT_script.Appear_speed = 0.08f;
}
if (GI_PROXY_POINT_script.Bounce_Intensity == 0.1f)
{
GI_PROXY_POINT_script.Bounce_Intensity = 0.4f;
}
else
{
GI_PROXY_POINT_script.Bounce_Intensity = 0.1f;
}
if (GI_PROXY_POINT_script.Color_change_speed == 4f)
{
GI_PROXY_POINT_script.Color_change_speed = 6f;
}
else
{
GI_PROXY_POINT_script.Color_change_speed = 4f;
}
if (GI_PROXY_POINT_script.Bounce_Range == 60f)
{
GI_PROXY_POINT_script.Bounce_Range = 50f;
}
else
{
GI_PROXY_POINT_script.Bounce_Range = 60f;
}
if (GI_PROXY_POINT_script.min_density_dist == 9f)
{
GI_PROXY_POINT_script.min_density_dist = 9f;
}
else
{
GI_PROXY_POINT_script.min_density_dist = 9f;
}
if (GI_PROXY_POINT_script.max_hit_light_dist == 7f)
{
GI_PROXY_POINT_script.max_hit_light_dist = 9f;
}
else
{
GI_PROXY_POINT_script.max_hit_light_dist = 7f;
}
if (GI_PROXY_POINT_script.PointLight_Radius == 9f)
{
GI_PROXY_POINT_script.PointLight_Radius = 10f;
}
else
{
GI_PROXY_POINT_script.PointLight_Radius = 9f;
}
}
}
private void Update()
{
if (LookAtTarget != null)
{
base.gameObject.transform.LookAt(LookAtTarget.position);
}
if (intro_ended)
{
return;
}
if (Time.fixedTime - current_time < intro_time)
{
if (!(Time.fixedTime - current_time < 1.6f))
{
if (Time.fixedTime - current_time < 8.5f)
{
Intro_letters.position = new Vector3(Intro_letters.position.x, Intro_letters.position.y, Mathf.Lerp(Intro_letters.position.z, Intro_letters.position.z + 2.35f * Time.deltaTime, 0.5f));
}
else if (Time.fixedTime - current_time < intro_time)
{
Intro_letters.position = new Vector3(Intro_letters.position.x, Intro_letters.position.y, Mathf.Lerp(Intro_letters.position.z, Intro_letters.position.z + 19.99f * Time.deltaTime, 0.5f));
}
else
{
_ = Time.fixedTime - current_time;
_ = intro_time;
}
}
if (Procedural_sphere.gameObject.activeInHierarchy)
{
Procedural_sphere.gameObject.SetActive(value: false);
}
GUI_texts.gameObject.SetActive(value: false);
}
else
{
intro_ended = true;
Intro_letters.gameObject.SetActive(value: false);
Intro_letters_GI_POOL.gameObject.SetActive(value: false);
GUI_texts.gameObject.SetActive(value: true);
if (!Procedural_sphere.gameObject.activeInHierarchy)
{
Procedural_sphere.gameObject.SetActive(value: true);
}
}
}
}
}