Files
BepInEx/Projects/BanquetForFools/Source/Assembly-CSharp/MoonlightRevealer.cs
2025-05-21 20:40:04 +02:00

221 lines
4.8 KiB
C#

using System;
using UnityEngine;
// Token: 0x0200000F RID: 15
[ExecuteInEditMode]
public class MoonlightRevealer : MonoBehaviour
{
// Token: 0x060000E4 RID: 228 RVA: 0x00011735 File Offset: 0x0000F935
protected virtual void Start()
{
this.Create();
}
// Token: 0x060000E5 RID: 229 RVA: 0x0001173D File Offset: 0x0000F93D
public void Create()
{
this.mTrans = base.transform;
if (this.interiorLight)
{
if (MoonlightSystem.otherInstance)
{
this.mRevealer = MoonlightSystem.otherInstance.CreateInteriorRevealer();
return;
}
}
else
{
this.mRevealer = MoonlightSystem.CreateRevealer();
}
}
// Token: 0x060000E6 RID: 230 RVA: 0x0001177B File Offset: 0x0000F97B
protected virtual void OnDisable()
{
if (this.mRevealer != null)
{
if (this.interiorLight)
{
MoonlightSystem.otherInstance.DeleteInteriorRevealer(this.mRevealer);
}
else
{
MoonlightSystem.DeleteRevealer(this.mRevealer);
}
this.mRevealer = null;
}
this.RemovePartyLight();
}
// Token: 0x060000E7 RID: 231 RVA: 0x000117B7 File Offset: 0x0000F9B7
protected virtual void OnDestroy()
{
if (this.mRevealer != null)
{
if (this.interiorLight)
{
MoonlightSystem.otherInstance.DeleteInteriorRevealer(this.mRevealer);
}
else
{
MoonlightSystem.DeleteRevealer(this.mRevealer);
}
this.mRevealer = null;
}
this.RemovePartyLight();
}
// Token: 0x060000E8 RID: 232 RVA: 0x000117F3 File Offset: 0x0000F9F3
private void RemovePartyLight()
{
if (this.yOffset != 0f)
{
new Vector3(-100000f, -100000f, 0f);
}
}
// Token: 0x060000E9 RID: 233 RVA: 0x00011818 File Offset: 0x0000FA18
protected virtual void LateUpdate()
{
if (this.isActive)
{
if (this.yOffset == 0f || this.characterID <= -1)
{
if (this.mRevealer == null)
{
this.Create();
}
if (this.lineOfSightCheck != MoonlightSystem.LOSChecks.OnlyOnce)
{
this.mRevealer.isValid = false;
}
if (this.yOffset != 0f)
{
this.mRevealer.pos = this.mTrans.position + new Vector3(0f, this.yOffset, 0f);
}
else
{
this.mRevealer.pos = this.mTrans.position;
}
this.mRevealer.inner = this.range.x;
this.mRevealer.outer = this.range.y;
this.mRevealer.los = this.lineOfSightCheck;
this.mRevealer.isActive = true;
this.mRevealer.lightColor = this.lightColor;
return;
}
Vector3 position = base.gameObject.transform.position;
position.y += this.yOffset;
Color currentPartyLightColor = Links.x.currentPartyLightColor;
if (this.main)
{
Shader.SetGlobalVector("_PartyLightPosition0", position);
Shader.SetGlobalVector("_PartyLightColor0", currentPartyLightColor);
float num = 1f;
if (Links.x.gameplay.gameHours >= 15f)
{
num = 1.3f;
}
if (Links.x.gameplay.gameHours == 16f)
{
num = 1.7f;
}
if (Links.x.gameplay.gameHours == 17f)
{
num = 2f;
}
if (Links.x.gameplay.gameHours == 18f)
{
num = 2f;
}
if (Links.x.gameplay.gameHours == 19f)
{
num = 2f;
}
if (Links.x.gameplay.gameHours == 20f)
{
num = 1.6f;
}
if (Links.x.gameplay.gameHours == 21f)
{
num = 1.3f;
}
if (Links.x.gameplay.gameHours == 22f)
{
num = 1.2f;
}
if (currentPartyLightColor == Links.x.torchColor)
{
if (Links.x.main.indoorID != "")
{
num = 0.5f;
}
if (Links.x.main.indoorID != "" || Links.x.gameplay.IsNight())
{
Shader.SetGlobalFloat("_Torch", 5f);
}
else if (Links.x.gameplay.IsEvening())
{
Shader.SetGlobalFloat("_Torch", 3f);
}
else
{
Shader.SetGlobalFloat("_Torch", 1f);
}
}
else
{
if (Links.x.main.indoorID != "")
{
num = 0.75f;
}
Shader.SetGlobalFloat("_Torch", 0f);
}
Shader.SetGlobalFloat("_PartyDist0", num);
return;
}
}
else if (this.mRevealer.isActive)
{
this.mRevealer.isActive = false;
this.mRevealer.isValid = false;
}
}
// Token: 0x060000EA RID: 234 RVA: 0x00011B64 File Offset: 0x0000FD64
public void Rebuild()
{
this.mRevealer.isValid = false;
}
// Token: 0x04000254 RID: 596
private Transform mTrans;
// Token: 0x04000255 RID: 597
public bool interiorLight;
// Token: 0x04000256 RID: 598
public Color32 lightColor;
// Token: 0x04000257 RID: 599
public Vector2 range = new Vector2(0.1f, 4f);
// Token: 0x04000258 RID: 600
public MoonlightSystem.LOSChecks lineOfSightCheck = MoonlightSystem.LOSChecks.OnlyOnce;
// Token: 0x04000259 RID: 601
public bool isActive = true;
// Token: 0x0400025A RID: 602
protected MoonlightSystem.Revealer mRevealer;
// Token: 0x0400025B RID: 603
public float yOffset;
// Token: 0x0400025C RID: 604
public int characterID = -1;
// Token: 0x0400025D RID: 605
public bool main;
}