mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using NewHorizons.External;
|
|
using OWML.Utils;
|
|
using UnityEngine;
|
|
using Logger = NewHorizons.Utility.Logger;
|
|
|
|
namespace NewHorizons.Atmosphere
|
|
{
|
|
static class VolumesBuilder
|
|
{
|
|
public static void Make(GameObject body, float innerRadius, float outerRadius)
|
|
{
|
|
GameObject volumesGO = new GameObject("Volumes");
|
|
volumesGO.SetActive(false);
|
|
volumesGO.transform.parent = body.transform;
|
|
|
|
GameObject rulesetGO = new GameObject();
|
|
rulesetGO.SetActive(false);
|
|
rulesetGO.transform.parent = volumesGO.transform;
|
|
|
|
SphereShape SS = rulesetGO.AddComponent<SphereShape>();
|
|
SS.SetCollisionMode(Shape.CollisionMode.Volume);
|
|
SS.SetLayer(Shape.Layer.Sector);
|
|
SS.layerMask = -1;
|
|
SS.pointChecksOnly = true;
|
|
SS.radius = outerRadius;
|
|
|
|
/*OWTriggerVolume trigvol = */
|
|
rulesetGO.AddComponent<OWTriggerVolume>();
|
|
|
|
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
|
|
PR.SetValue("_altitudeFloor", innerRadius);
|
|
PR.SetValue("_altitudeCeiling", outerRadius);
|
|
|
|
EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>();
|
|
ER.SetValue("_type", EffectRuleset.BubbleType.Underwater);
|
|
ER.SetValue("_material", GameObject.Find("RulesetVolumes_GD").GetComponent<RulesetVolume>().GetValue<Material>("_material"));
|
|
ER.SetValue("_cloudMaterial", GameObject.Find("RulesetVolumes_GD").GetComponent<RulesetVolume>().GetValue<Material>("_cloudMaterial"));
|
|
|
|
volumesGO.transform.localPosition = Vector3.zero;
|
|
rulesetGO.SetActive(true);
|
|
volumesGO.SetActive(true);
|
|
}
|
|
}
|
|
}
|