new-horizons/NewHorizons/General/AmbientLightBuilder.cs
Nick J. Connors d721201b0e Forked
Renamed to new horizons, updated to current versions of OWML and Outer Wilds, added BlackHoleBuilder, LavaBuilder, RingBuilder. Added support to modify existing planets with configs.
2021-12-08 00:09:11 -05:00

33 lines
1.1 KiB
C#

using NewHorizons.External;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.General
{
static class AmbientLightBuilder
{
public static void Make(GameObject body, Sector sector, IPlanetConfig config)
{
GameObject lightGO = new GameObject("Lights");
lightGO.SetActive(false);
lightGO.transform.parent = body.transform;
Light L = lightGO.AddComponent<Light>();
L.type = LightType.Point;
L.range = config.AtmoEndSize + 10;
L.color = (config.LightTint != null) ? config.LightTint.ToColor32() : (Color32)Color.black;
L.intensity = 0.8f;
L.shadows = LightShadows.None;
L.cookie = GameObject.Find("/GiantsDeep_Body/AmbientLight_GD").GetComponent<Light>().cookie;
SectorLightsCullGroup SLCG = lightGO.AddComponent<SectorLightsCullGroup>();
SLCG.SetSector(sector);
lightGO.SetActive(true);
Logger.Log("Finished building ambient light", Logger.LogType.Log);
}
}
}