mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
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.
59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
using OWML.Utils;
|
|
using UnityEngine;
|
|
using Logger = NewHorizons.Utility.Logger;
|
|
|
|
namespace NewHorizons.Atmosphere
|
|
{
|
|
static class EffectsBuilder
|
|
{
|
|
public static void Make(GameObject body, Sector sector, float groundSize, float waterSize, float atmoEnd, bool hasRain, bool hasSnow)
|
|
{
|
|
GameObject effectsGO = new GameObject("Effects");
|
|
effectsGO.SetActive(false);
|
|
effectsGO.transform.parent = body.transform;
|
|
effectsGO.transform.localPosition = Vector3.zero;
|
|
|
|
SectorCullGroup SCG = effectsGO.AddComponent<SectorCullGroup>();
|
|
SCG.SetValue("_sector", sector);
|
|
SCG.SetValue("_particleSystemSuspendMode", CullGroup.ParticleSystemSuspendMode.Stop);
|
|
SCG.SetValue("_occlusionCulling", false);
|
|
SCG.SetValue("_dynamicCullingBounds", false);
|
|
SCG.SetValue("_waitForStreaming", false);
|
|
|
|
if(hasRain)
|
|
{
|
|
var rainGO = GameObject.Instantiate(GameObject.Find("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
|
|
rainGO.transform.localPosition = Vector3.zero;
|
|
|
|
var pvc = rainGO.GetComponent<PlanetaryVectionController>();
|
|
pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) }));
|
|
|
|
rainGO.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
|
|
rainGO.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { });
|
|
rainGO.SetActive(true);
|
|
}
|
|
|
|
if(hasSnow)
|
|
{
|
|
var snowGO = GameObject.Instantiate(GameObject.Find("/BrittleHollow_Body/Sector_BH/Effects_BH/Effects_BH_Snowflakes"), effectsGO.transform);
|
|
snowGO.transform.localPosition = Vector3.zero;
|
|
|
|
var pvc = snowGO.GetComponent<PlanetaryVectionController>();
|
|
pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) }));
|
|
|
|
var particleSystem = snowGO.GetComponent<ParticleSystem>();
|
|
var e = particleSystem.emission;
|
|
e.rateOverTime = 50;
|
|
|
|
snowGO.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
|
|
snowGO.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { });
|
|
snowGO.SetActive(true);
|
|
}
|
|
|
|
effectsGO.SetActive(true);
|
|
|
|
Logger.Log("Finished building effects", Logger.LogType.Log);
|
|
}
|
|
}
|
|
}
|