mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
make background module
This commit is contained in:
parent
840ae1c09f
commit
4c552db703
@ -50,15 +50,34 @@ namespace NewHorizons.External.Configs
|
||||
public string ambience;
|
||||
|
||||
/// <summary>
|
||||
/// Changes the speed the skybox rotates (and by extension the main menu planet). This is in degrees per second.
|
||||
/// Edit properties of the background
|
||||
/// </summary>
|
||||
public float rotationSpeed = 1;
|
||||
public BackgroundModule Background;
|
||||
|
||||
/// <summary>
|
||||
/// Edit properties of the main menu planet
|
||||
/// </summary>
|
||||
public MenuPlanetModule MenuPlanet;
|
||||
|
||||
[JsonObject]
|
||||
public class BackgroundModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes the speed the background rotates (and by extension the main menu planet). This is in degrees per second.
|
||||
/// </summary>
|
||||
public float rotationSpeed = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Disables the renderers of objects at the provided paths
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// A list of DetailInfos to populate the background with.
|
||||
/// </summary>
|
||||
public SimplifiedDetailInfo[] details;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class MenuPlanetModule
|
||||
{
|
||||
|
||||
@ -127,7 +127,26 @@ namespace NewHorizons.Handlers
|
||||
Delay.FireOnNextUpdate(() => ambienceSource.AssignAudioLibraryClip(audioType));
|
||||
}
|
||||
|
||||
SearchUtilities.Find("Scene/Background").GetComponent<RotateTransform>()._degreesPerSecond = config.rotationSpeed;
|
||||
if (config.Background != null)
|
||||
{
|
||||
var background = SearchUtilities.Find("Scene/Background");
|
||||
|
||||
if (config.Background.removeChildren != null)
|
||||
{
|
||||
RemoveChildren(background, config.Background.removeChildren);
|
||||
}
|
||||
|
||||
if (config.Background.details != null)
|
||||
{
|
||||
foreach (var simplifiedDetail in config.Background.details)
|
||||
{
|
||||
DetailBuilder.Make(background, null, mod, new DetailInfo(simplifiedDetail));
|
||||
}
|
||||
}
|
||||
|
||||
var rotator = background.GetComponent<RotateTransform>();
|
||||
rotator._degreesPerSecond = config.Background.rotationSpeed;
|
||||
}
|
||||
|
||||
if (config.MenuPlanet != null)
|
||||
{
|
||||
@ -152,7 +171,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (config.MenuPlanet.destroyMenuPlanet)
|
||||
{
|
||||
menuPlanet.SetActive(false);
|
||||
SearchUtilities.Find("Scene/Background/PlanetPivot/PlanetRoot").SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user