mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Disable ambient lights in dream world
This commit is contained in:
parent
6528d2c654
commit
637fa401cf
@ -2,6 +2,7 @@ using UnityEngine;
|
|||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility.Files;
|
using NewHorizons.Utility.Files;
|
||||||
|
using NewHorizons.Components;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.General
|
namespace NewHorizons.Builder.General
|
||||||
{
|
{
|
||||||
@ -64,6 +65,8 @@ namespace NewHorizons.Builder.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lightGO.AddComponent<AmbientLight>();
|
||||||
|
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
NewHorizons/Components/AmbientLight.cs
Normal file
27
NewHorizons/Components/AmbientLight.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Components
|
||||||
|
{
|
||||||
|
public class AmbientLight : MonoBehaviour
|
||||||
|
{
|
||||||
|
Light light;
|
||||||
|
float cachedIntensity;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
light = GetComponent<Light>();
|
||||||
|
cachedIntensity = light.intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
var targetIntensity = PlayerState.InDreamWorld() ? 0f : cachedIntensity;
|
||||||
|
light.intensity = Mathf.MoveTowards(light.intensity, targetIntensity, Time.deltaTime * 5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user