Improved main menu background

This commit is contained in:
Nick J. Connors 2022-01-04 19:41:16 -05:00
parent 135679f797
commit 16ed06ff58
2 changed files with 20 additions and 8 deletions

View File

@ -15,7 +15,7 @@ namespace NewHorizons.Builder.Body
public static Shader RingShader; public static Shader RingShader;
public static Shader UnlitShader; public static Shader UnlitShader;
public static void Make(GameObject body, RingModule ring, IModAssets assets) public static GameObject Make(GameObject body, RingModule ring, IModAssets assets)
{ {
Texture2D ringTexture; Texture2D ringTexture;
try try
@ -25,7 +25,7 @@ namespace NewHorizons.Builder.Body
catch (Exception e) catch (Exception e)
{ {
Logger.LogError($"Couldn't load Ring texture, {e.Message}, {e.StackTrace}"); Logger.LogError($"Couldn't load Ring texture, {e.Message}, {e.StackTrace}");
return; return null;
} }
var ringGO = new GameObject("Ring"); var ringGO = new GameObject("Ring");
@ -51,6 +51,8 @@ namespace NewHorizons.Builder.Body
// Make mesh // Make mesh
var segments = (int)Mathf.Clamp(ring.OuterRadius, 20, 2000); var segments = (int)Mathf.Clamp(ring.OuterRadius, 20, 2000);
BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius); BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius);
return ringGO;
} }
// Thank you https://github.com/boardtobits/planet-ring-mesh/blob/master/PlanetRing.cs // Thank you https://github.com/boardtobits/planet-ring-mesh/blob/master/PlanetRing.cs

View File

@ -214,21 +214,21 @@ namespace NewHorizons
body1 = LoadTitleScreenBody(eligible[indices[0]]); body1 = LoadTitleScreenBody(eligible[indices[0]]);
body1.transform.localScale = Vector3.one * (body1.transform.localScale.x) * 0.4f; body1.transform.localScale = Vector3.one * (body1.transform.localScale.x) * 0.4f;
body1.transform.localPosition = new Vector3(7.4277f, 124.7193f, 41.7567f); body1.transform.parent.localPosition = new Vector3(-0.3523f, 143.5564f, 31.8968f);
body1.transform.localRotation = Quaternion.Euler(53.5006f, 207.0599f, 0f); body1.transform.localRotation = Quaternion.Euler(53.5006f, 207.0599f, 0f);
if (selectionCount > 1) if (selectionCount > 1)
{ {
body2 = LoadTitleScreenBody(eligible[indices[1]]); body2 = LoadTitleScreenBody(eligible[indices[1]]);
body2.transform.localScale = Vector3.one * (body2.transform.localScale.x) * 0.4f; body2.transform.localScale = Vector3.one * (body2.transform.localScale.x) * 0.4f;
body2.transform.localPosition = new Vector3(-33.3091f, 110.2332f, -30.9288f); body2.transform.parent.localPosition = new Vector3(-33.3091f, 110.2332f, -30.9288f);
body2.transform.localRotation = Quaternion.Euler(346.7481f, 143.6107f, 5.3171f); body2.transform.localRotation = Quaternion.Euler(346.7481f, 143.6107f, 5.3171f);
} }
if (selectionCount > 2) if (selectionCount > 2)
{ {
body3 = LoadTitleScreenBody(eligible[indices[2]]); body3 = LoadTitleScreenBody(eligible[indices[2]]);
body3.transform.localScale = Vector3.one * (body3.transform.localScale.x) * 0.4f; body3.transform.localScale = Vector3.one * (body3.transform.localScale.x) * 0.4f;
body3.transform.localPosition = new Vector3(-7.8373f, 136.6149f, -7.1662f); body3.transform.parent.localPosition = new Vector3(-7.8373f, 136.6149f, -7.1662f);
body3.transform.localRotation = Quaternion.Euler(350.0425f, 254.7936f, 353.324f); body3.transform.localRotation = Quaternion.Euler(350.0425f, 254.7936f, 353.324f);
} }
@ -271,17 +271,27 @@ namespace NewHorizons
} }
HeightMapBuilder.Make(titleScreenGO, heightMap, body.Assets); HeightMapBuilder.Make(titleScreenGO, heightMap, body.Assets);
GameObject pivot = GameObject.Instantiate(GameObject.Find("Scene/Background/PlanetPivot"), GameObject.Find("Scene/Background").transform);
pivot.GetComponent<RotateTransform>()._degreesPerSecond = 10f;
foreach (Transform child in pivot.transform)
{
GameObject.Destroy(child.gameObject);
}
pivot.name = "Pivot";
if (body.Config.Ring != null) if (body.Config.Ring != null)
{ {
RingModule newRing = new RingModule(); RingModule newRing = new RingModule();
newRing.InnerRadius = size * 1.2f; newRing.InnerRadius = size * 1.2f;
newRing.OuterRadius = size * 2f; newRing.OuterRadius = size * 2f;
newRing.Texture = body.Config.Ring.Texture; newRing.Texture = body.Config.Ring.Texture;
RingBuilder.Make(titleScreenGO, newRing, body.Assets); var ring = RingBuilder.Make(titleScreenGO, newRing, body.Assets);
titleScreenGO.transform.localScale = Vector3.one * 0.8f; titleScreenGO.transform.localScale = Vector3.one * 0.8f;
pivot.GetComponent<RotateTransform>()._degreesPerSecond = 0f;
} }
var rt = titleScreenGO.AddComponent<RotateTransform>();
titleScreenGO.transform.parent = GameObject.Find("Scene/Background").transform; titleScreenGO.transform.parent = pivot.transform;
titleScreenGO.transform.localPosition = Vector3.zero; titleScreenGO.transform.localPosition = Vector3.zero;
return titleScreenGO; return titleScreenGO;