174 lines
4.5 KiB
C#
174 lines
4.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x02000089 RID: 137
|
|
[ExecuteInEditMode]
|
|
public class Sunlight : MonoBehaviour
|
|
{
|
|
// Token: 0x06000DD0 RID: 3536 RVA: 0x00105294 File Offset: 0x00103494
|
|
private void Awake()
|
|
{
|
|
this.ambientSkyOriginal = this.ambientSky;
|
|
this.ambientEquatorOriginal = this.ambientEquator;
|
|
this.ambientGroundOriginal = this.ambientGround;
|
|
RenderSettings.ambientSkyColor = this.ambientSky;
|
|
RenderSettings.ambientEquatorColor = this.ambientEquator;
|
|
RenderSettings.ambientGroundColor = this.ambientGround;
|
|
}
|
|
|
|
// Token: 0x06000DD1 RID: 3537 RVA: 0x001052E6 File Offset: 0x001034E6
|
|
private void Start()
|
|
{
|
|
this.prevSunColor = this.sunlight.color * this.sunDarknessMultiplier;
|
|
this.SwitchToInterior();
|
|
}
|
|
|
|
// Token: 0x06000DD2 RID: 3538 RVA: 0x0010530A File Offset: 0x0010350A
|
|
private void OnEnable()
|
|
{
|
|
this.tr = base.transform;
|
|
}
|
|
|
|
// Token: 0x06000DD3 RID: 3539 RVA: 0x00105318 File Offset: 0x00103518
|
|
public float ChangeTime(float seconds)
|
|
{
|
|
float num = seconds / 60f / 1440f;
|
|
if (num > 1f)
|
|
{
|
|
num -= 1f;
|
|
Links.x.gameplay.SetNewDay();
|
|
}
|
|
this.animator.Play("Sunlight", -1, num);
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06000DD4 RID: 3540 RVA: 0x00105368 File Offset: 0x00103568
|
|
private void Update()
|
|
{
|
|
this.prevSunColor = Color.Lerp(this.prevSunColor, this.sunlightColor * this.sunDarknessMultiplier, Time.deltaTime * 20f);
|
|
if (!this.indoors)
|
|
{
|
|
RenderSettings.ambientSkyColor = this.ambientSky * this.darknessMultiplier;
|
|
RenderSettings.ambientEquatorColor = this.ambientEquator * this.darknessMultiplier;
|
|
RenderSettings.ambientGroundColor = this.ambientGround * this.darknessMultiplier;
|
|
this.sunlight.color = this.prevSunColor;
|
|
this.exteriorCharacterLight.color = this.prevSunColor;
|
|
this.tr.rotation = Quaternion.Euler(this.exteriorRotation);
|
|
}
|
|
else
|
|
{
|
|
RenderSettings.ambientSkyColor = Color.black;
|
|
RenderSettings.ambientEquatorColor = Color.black;
|
|
RenderSettings.ambientGroundColor = Color.black;
|
|
this.sunlight.color = Color.black;
|
|
this.tr.rotation = Quaternion.Euler(this.interiorRotation);
|
|
}
|
|
if (!Links.x)
|
|
{
|
|
this.animator.speed = this.animatorSpeed;
|
|
return;
|
|
}
|
|
if (Links.x.creation || !Links.x.gaia.sceneLoaded || Records.x.pocketPause || Records.x.removeControls)
|
|
{
|
|
this.animator.speed = 0f;
|
|
return;
|
|
}
|
|
this.animator.speed = this.animatorSpeed;
|
|
}
|
|
|
|
// Token: 0x06000DD5 RID: 3541 RVA: 0x001054E4 File Offset: 0x001036E4
|
|
public void NewDay()
|
|
{
|
|
this.animator.Play("Sunlight", -1, 0f);
|
|
}
|
|
|
|
// Token: 0x06000DD6 RID: 3542 RVA: 0x001054FC File Offset: 0x001036FC
|
|
public void SwitchToInterior()
|
|
{
|
|
this.indoors = true;
|
|
this.sunlight.shadows = LightShadows.Soft;
|
|
this.sunlight.cullingMask = this.interior;
|
|
this.exteriorCharacterLight.enabled = false;
|
|
this.interiorSunlight.enabled = true;
|
|
}
|
|
|
|
// Token: 0x06000DD7 RID: 3543 RVA: 0x0010554C File Offset: 0x0010374C
|
|
public void SwitchToExterior()
|
|
{
|
|
this.indoors = false;
|
|
this.sunlight.shadows = LightShadows.Soft;
|
|
this.sunlight.cullingMask = this.exterior;
|
|
this.exteriorCharacterLight.enabled = true;
|
|
this.interiorSunlight.enabled = false;
|
|
}
|
|
|
|
// Token: 0x0400164C RID: 5708
|
|
public Animator animator;
|
|
|
|
// Token: 0x0400164D RID: 5709
|
|
public Light sunlight;
|
|
|
|
// Token: 0x0400164E RID: 5710
|
|
public Light interiorSunlight;
|
|
|
|
// Token: 0x0400164F RID: 5711
|
|
public Light exteriorCharacterLight;
|
|
|
|
// Token: 0x04001650 RID: 5712
|
|
public Color ambientSky;
|
|
|
|
// Token: 0x04001651 RID: 5713
|
|
public Color ambientEquator;
|
|
|
|
// Token: 0x04001652 RID: 5714
|
|
public Color ambientGround;
|
|
|
|
// Token: 0x04001653 RID: 5715
|
|
public Color sunlightColor;
|
|
|
|
// Token: 0x04001654 RID: 5716
|
|
public float animatorSpeed = 0.03f;
|
|
|
|
// Token: 0x04001655 RID: 5717
|
|
public float roundNumber = 10f;
|
|
|
|
// Token: 0x04001656 RID: 5718
|
|
public Vector3 sunRotation;
|
|
|
|
// Token: 0x04001657 RID: 5719
|
|
private Transform tr;
|
|
|
|
// Token: 0x04001658 RID: 5720
|
|
private bool indoors;
|
|
|
|
// Token: 0x04001659 RID: 5721
|
|
private Color prevSunColor;
|
|
|
|
// Token: 0x0400165A RID: 5722
|
|
public Vector3 exteriorRotation;
|
|
|
|
// Token: 0x0400165B RID: 5723
|
|
public Vector3 interiorRotation;
|
|
|
|
// Token: 0x0400165C RID: 5724
|
|
public LayerMask interior;
|
|
|
|
// Token: 0x0400165D RID: 5725
|
|
public LayerMask exterior;
|
|
|
|
// Token: 0x0400165E RID: 5726
|
|
public float darknessMultiplier = 1f;
|
|
|
|
// Token: 0x0400165F RID: 5727
|
|
public float sunDarknessMultiplier = 1f;
|
|
|
|
// Token: 0x04001660 RID: 5728
|
|
private Color ambientSkyOriginal;
|
|
|
|
// Token: 0x04001661 RID: 5729
|
|
private Color ambientEquatorOriginal;
|
|
|
|
// Token: 0x04001662 RID: 5730
|
|
private Color ambientGroundOriginal;
|
|
}
|