mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using NewHorizons.Builder.Body;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace NewHorizons.Components.SizeControllers
|
|
{
|
|
public class StarAtmosphereSizeController : SizeController
|
|
{
|
|
private PlanetaryFogController fog;
|
|
public float initialSize;
|
|
private MeshRenderer[] atmosphereRenderers;
|
|
|
|
void Awake()
|
|
{
|
|
fog = GetComponentInChildren<PlanetaryFogController>();
|
|
atmosphereRenderers = transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>();
|
|
}
|
|
|
|
protected new void FixedUpdate()
|
|
{
|
|
base.FixedUpdate();
|
|
fog.fogRadius = initialSize * CurrentScale * StarBuilder.OuterRadiusRatio;
|
|
fog.lodFadeDistance = initialSize * CurrentScale * (StarBuilder.OuterRadiusRatio - 1f);
|
|
foreach (var lod in atmosphereRenderers)
|
|
{
|
|
lod.material.SetFloat("_InnerRadius", initialSize * CurrentScale);
|
|
lod.material.SetFloat("_OuterRadius", initialSize * CurrentScale * StarBuilder.OuterRadiusRatio);
|
|
}
|
|
}
|
|
}
|
|
}
|