mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixes
Fixed comet tail, gravity radius, axial tilt, linear gravity eccentric orbit lines, detail rotation, changed menu screen planets, map satellite orbit,
This commit is contained in:
parent
e5ced93768
commit
a158f05a9d
@ -17,7 +17,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
cometTail.transform.localPosition = Vector3.zero;
|
cometTail.transform.localPosition = Vector3.zero;
|
||||||
cometTail.name = "CometTail";
|
cometTail.name = "CometTail";
|
||||||
cometTail.transform.localScale = Vector3.one * module.SurfaceSize / 110;
|
cometTail.transform.localScale = Vector3.one * module.SurfaceSize / 110;
|
||||||
cometTail.transform.localRotation = Quaternion.Euler(0, 180, 90);
|
cometTail.transform.localRotation = Quaternion.Euler(0, 90, 90);
|
||||||
/*
|
/*
|
||||||
var alignment = cometTail.AddComponent<AlignWithTargetBody>();
|
var alignment = cometTail.AddComponent<AlignWithTargetBody>();
|
||||||
alignment.SetTargetBody(primary.GetAttachedOWRigidbody());
|
alignment.SetTargetBody(primary.GetAttachedOWRigidbody());
|
||||||
|
|||||||
@ -19,6 +19,11 @@ namespace NewHorizons.Builder.General
|
|||||||
var gravityRadius = GM / 0.1f;
|
var gravityRadius = GM / 0.1f;
|
||||||
if (exponent == 2f) gravityRadius = Mathf.Sqrt(gravityRadius);
|
if (exponent == 2f) gravityRadius = Mathf.Sqrt(gravityRadius);
|
||||||
|
|
||||||
|
// To let you actually orbit things the way you would expect we cap this at 4x the diameter if its not a star or black hole (this is what giants deep has)
|
||||||
|
if (config.Star != null || config.Singularity != null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.SurfaceSize);
|
||||||
|
else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.SurfaceSize);
|
||||||
|
if (config.Base.SphereOfInfluence != 0f) gravityRadius = config.Base.SphereOfInfluence;
|
||||||
|
|
||||||
GameObject gravityGO = new GameObject("GravityWell");
|
GameObject gravityGO = new GameObject("GravityWell");
|
||||||
gravityGO.transform.parent = body.transform;
|
gravityGO.transform.parent = body.transform;
|
||||||
gravityGO.transform.localPosition = Vector3.zero;
|
gravityGO.transform.localPosition = Vector3.zero;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ namespace NewHorizons.Builder.Orbital
|
|||||||
// Rotation
|
// Rotation
|
||||||
initialMotion.SetValue("_initAngularSpeed", orbit.SiderealPeriod == 0 ? 0f : 1.0f / orbit.SiderealPeriod);
|
initialMotion.SetValue("_initAngularSpeed", orbit.SiderealPeriod == 0 ? 0f : 1.0f / orbit.SiderealPeriod);
|
||||||
|
|
||||||
var rotationAxis = Quaternion.AngleAxis(orbit.AxialTilt + orbit.Inclination, Vector3.right) * Vector3.up;
|
var rotationAxis = Quaternion.AngleAxis(orbit.AxialTilt + orbit.Inclination + 90f, Vector3.right) * Vector3.up;
|
||||||
body.transform.rotation = Quaternion.FromToRotation(Vector3.up, rotationAxis);
|
body.transform.rotation = Quaternion.FromToRotation(Vector3.up, rotationAxis);
|
||||||
|
|
||||||
initialMotion._orbitImpulseScalar = 0f;
|
initialMotion._orbitImpulseScalar = 0f;
|
||||||
|
|||||||
@ -23,10 +23,16 @@ namespace NewHorizons.Builder.Orbital
|
|||||||
|
|
||||||
var ecc = config.Orbit.Eccentricity;
|
var ecc = config.Orbit.Eccentricity;
|
||||||
|
|
||||||
|
var parentGravity = astroobject.GetPrimaryBody()?.GetGravityVolume();
|
||||||
|
|
||||||
OrbitLine orbitLine;
|
OrbitLine orbitLine;
|
||||||
if (ecc == 0) orbitLine = orbitGO.AddComponent<OrbitLine>();
|
if (ecc == 0)
|
||||||
else if (ecc > 0 && ecc < 1) orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
|
orbitLine = orbitGO.AddComponent<OrbitLine>();
|
||||||
else orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
// Doesn't work for linear eccentric falloff
|
||||||
|
else if (ecc > 0 && ecc < 1 && (parentGravity != null && parentGravity._falloffType == GravityVolume.FalloffType.inverseSquared))
|
||||||
|
orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
|
||||||
|
else
|
||||||
|
orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||||
|
|
||||||
var color = Color.white;
|
var color = Color.white;
|
||||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
|
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
|
||||||
|
|||||||
@ -94,8 +94,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
prop.transform.parent = go.transform;
|
prop.transform.parent = go.transform;
|
||||||
prop.transform.localPosition = position == null ? Vector3.zero : (Vector3)position;
|
prop.transform.localPosition = position == null ? Vector3.zero : (Vector3)position;
|
||||||
|
|
||||||
Quaternion rot = rotation == null ? prefab.transform.rotation : Quaternion.Euler((Vector3)rotation);
|
Quaternion rot = rotation == null ? Quaternion.identity : Quaternion.Euler((Vector3)rotation);
|
||||||
prop.transform.rotation = rot;
|
prop.transform.localRotation = rot;
|
||||||
if (alignWithNormal)
|
if (alignWithNormal)
|
||||||
{
|
{
|
||||||
var up = prop.transform.localPosition.normalized;
|
var up = prop.transform.localPosition.normalized;
|
||||||
@ -116,7 +116,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
private static void MakeScatter(GameObject go, PropModule.ScatterInfo[] scatterInfo, float radius, Sector sector, IModAssets assets, string uniqueModName)
|
private static void MakeScatter(GameObject go, PropModule.ScatterInfo[] scatterInfo, float radius, Sector sector, IModAssets assets, string uniqueModName)
|
||||||
{
|
{
|
||||||
var area = 4f * Mathf.PI * radius * radius;
|
var area = 4f * Mathf.PI * radius * radius;
|
||||||
var points = FibonacciSphere((int)area);
|
var points = RandomUtility.FibonacciSphere((int)area);
|
||||||
|
|
||||||
foreach (var propInfo in scatterInfo)
|
foreach (var propInfo in scatterInfo)
|
||||||
{
|
{
|
||||||
@ -136,27 +136,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Vector3> FibonacciSphere(int samples)
|
|
||||||
{
|
|
||||||
List<Vector3> points = new List<Vector3>();
|
|
||||||
|
|
||||||
var phi = Mathf.PI * (3f - Mathf.Sqrt(5f));
|
|
||||||
|
|
||||||
for(int i = 0; i < samples; i++)
|
|
||||||
{
|
|
||||||
var y = 1 - (i / (float)(samples - 1)) * 2f;
|
|
||||||
var radius = Mathf.Sqrt(1 - y * y);
|
|
||||||
|
|
||||||
var theta = phi * i;
|
|
||||||
|
|
||||||
var x = Mathf.Cos(theta) * radius;
|
|
||||||
var z = Mathf.Sin(theta) * radius;
|
|
||||||
|
|
||||||
points.Add(new Vector3(x, y, z));
|
|
||||||
}
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObject LoadPrefab(string assetBundle, string path, string uniqueModName, IModAssets assets)
|
private static GameObject LoadPrefab(string assetBundle, string path, string uniqueModName, IModAssets assets)
|
||||||
{
|
{
|
||||||
string key = uniqueModName + "." + assetBundle;
|
string key = uniqueModName + "." + assetBundle;
|
||||||
|
|||||||
22
NewHorizons/Components/MapSatelliteOrbitFix.cs
Normal file
22
NewHorizons/Components/MapSatelliteOrbitFix.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using NewHorizons.Builder.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Components
|
||||||
|
{
|
||||||
|
public class MapSatelliteOrbitFix : MonoBehaviour
|
||||||
|
{
|
||||||
|
public void Awake()
|
||||||
|
{
|
||||||
|
var detector = base.transform.GetComponentInChildren<DynamicForceDetector>();
|
||||||
|
var ao = base.GetComponent<AstroObject>();
|
||||||
|
var newDetector = DetectorBuilder.Make(base.gameObject, ao.GetAttachedOWRigidbody(), ao.GetPrimaryBody(), ao);
|
||||||
|
newDetector.transform.parent = detector.transform.parent;
|
||||||
|
GameObject.Destroy(detector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
NewHorizons/External/BaseModule.cs
vendored
1
NewHorizons/External/BaseModule.cs
vendored
@ -14,6 +14,7 @@ namespace NewHorizons.External
|
|||||||
public float SurfaceGravity { get; set; }
|
public float SurfaceGravity { get; set; }
|
||||||
public string GravityFallOff { get; set; } = "linear";
|
public string GravityFallOff { get; set; } = "linear";
|
||||||
public float SurfaceSize { get; set; }
|
public float SurfaceSize { get; set; }
|
||||||
|
public float SphereOfInfluence { get; set; }
|
||||||
public float WaterSize { get; set; }
|
public float WaterSize { get; set; }
|
||||||
public float GroundSize { get; set; }
|
public float GroundSize { get; set; }
|
||||||
public float LavaSize { get; set; }
|
public float LavaSize { get; set; }
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using NewHorizons.Builder.Body;
|
|||||||
using NewHorizons.Builder.General;
|
using NewHorizons.Builder.General;
|
||||||
using NewHorizons.Builder.Orbital;
|
using NewHorizons.Builder.Orbital;
|
||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
|
using NewHorizons.Components;
|
||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
using NewHorizons.OrbitalPhysics;
|
using NewHorizons.OrbitalPhysics;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
@ -24,7 +25,6 @@ namespace NewHorizons
|
|||||||
{
|
{
|
||||||
public class Main : ModBehaviour
|
public class Main : ModBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
public static AssetBundle ShaderBundle;
|
public static AssetBundle ShaderBundle;
|
||||||
public static Main Instance { get; private set; }
|
public static Main Instance { get; private set; }
|
||||||
|
|
||||||
@ -34,7 +34,8 @@ namespace NewHorizons
|
|||||||
public static float FurthestOrbit { get; set; } = 50000f;
|
public static float FurthestOrbit { get; set; } = 50000f;
|
||||||
public StarLightController StarLightController { get; private set; }
|
public StarLightController StarLightController { get; private set; }
|
||||||
|
|
||||||
private static string _currentStarSystem = "SolarSystem";
|
private string _currentStarSystem = "SolarSystem";
|
||||||
|
private bool _isChangingStarSystem = false;
|
||||||
|
|
||||||
public override object GetApi()
|
public override object GetApi()
|
||||||
{
|
{
|
||||||
@ -45,6 +46,7 @@ namespace NewHorizons
|
|||||||
{
|
{
|
||||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
|
||||||
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
||||||
|
|
||||||
Utility.Patches.Apply();
|
Utility.Patches.Apply();
|
||||||
@ -60,7 +62,7 @@ namespace NewHorizons
|
|||||||
Logger.LogWarning("Couldn't find planets folder");
|
Logger.LogWarning("Couldn't find planets folder");
|
||||||
}
|
}
|
||||||
|
|
||||||
//UnityEngine.Random.InitState();
|
UnityEngine.Random.InitState((int)DateTime.Now.Ticks);
|
||||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single));
|
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,21 +70,36 @@ namespace NewHorizons
|
|||||||
{
|
{
|
||||||
Logger.Log($"Destroying NewHorizons");
|
Logger.Log($"Destroying NewHorizons");
|
||||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||||
|
GlobalMessenger<DeathType>.RemoveListener("PlayerDeath", OnDeath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDeath(DeathType _)
|
||||||
|
{
|
||||||
|
// We reset the solar system on death (unless we just killed the player)
|
||||||
|
if (!_isChangingStarSystem) _currentStarSystem = "SolarSystem";
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
{
|
{
|
||||||
Logger.Log($"Scene Loaded: {scene.name} {mode}");
|
Logger.Log($"Scene Loaded: {scene.name} {mode}");
|
||||||
|
|
||||||
|
_isChangingStarSystem = false;
|
||||||
|
|
||||||
HeavenlyBodyBuilder.Reset();
|
HeavenlyBodyBuilder.Reset();
|
||||||
|
|
||||||
if (scene.name.Equals("TitleScreen")) DisplayBodyOnTitleScreen();
|
if (scene.name.Equals("TitleScreen")) DisplayBodyOnTitleScreen();
|
||||||
|
|
||||||
if (scene.name != "SolarSystem") return;
|
if (scene.name != "SolarSystem")
|
||||||
|
{
|
||||||
|
// Reset back to original solar system after going to main menu.
|
||||||
|
_currentStarSystem = "SolarSystem";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NewHorizonsData.Load();
|
NewHorizonsData.Load();
|
||||||
|
|
||||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => ShipLogBuilder.Init());
|
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => ShipLogBuilder.Init());
|
||||||
|
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AstroObjectLocator.GetAstroObject("MapSatellite").gameObject.AddComponent<MapSatelliteOrbitFix>());
|
||||||
|
|
||||||
// Need to manage this when there are multiple stars
|
// Need to manage this when there are multiple stars
|
||||||
var sun = GameObject.Find("Sun_Body");
|
var sun = GameObject.Find("Sun_Body");
|
||||||
@ -188,13 +205,51 @@ namespace NewHorizons
|
|||||||
public void DisplayBodyOnTitleScreen()
|
public void DisplayBodyOnTitleScreen()
|
||||||
{
|
{
|
||||||
//Try loading one planet why not
|
//Try loading one planet why not
|
||||||
GameObject titleScreenGO = new GameObject("TitleScreenPlanet");
|
var eligible = BodyList.Where(b => b.Config.HeightMap != null || b.Config.Atmosphere?.Cloud != null).ToArray();
|
||||||
var eligible = BodyList.Where(b => b.Config.Ring != null && (b.Config.HeightMap != null || (b.Config.Atmosphere?.Cloud != null))).ToArray();
|
var eligibleCount = eligible.Count();
|
||||||
var body = eligible[UnityEngine.Random.Range(0, eligible.Count())];
|
if (eligibleCount == 0) return;
|
||||||
|
|
||||||
|
var selectionCount = Mathf.Max(eligibleCount, UnityEngine.Random.Range(1, 3));
|
||||||
|
var indices = RandomUtility.GetUniqueRandomArray(0, eligible.Count(), selectionCount);
|
||||||
|
|
||||||
|
var body = eligible[UnityEngine.Random.Range(0, eligibleCount)];
|
||||||
|
|
||||||
Logger.Log($"Displaying {body.Config.Name} on the title screen");
|
Logger.Log($"Displaying {body.Config.Name} on the title screen");
|
||||||
|
|
||||||
var flag = false;
|
GameObject body1, body2, body3;
|
||||||
|
|
||||||
|
body1 = LoadTitleScreenBody(eligible[indices[0]]);
|
||||||
|
if (selectionCount > 2)
|
||||||
|
{
|
||||||
|
body1.transform.localScale = Vector3.one * (body1.transform.localScale.x) * 0.3f;
|
||||||
|
body1.transform.localPosition = new Vector3(0, -10, 0);
|
||||||
|
body2 = LoadTitleScreenBody(eligible[indices[1]]);
|
||||||
|
body2.transform.localScale = Vector3.one * (body2.transform.localScale.x) * 0.3f;
|
||||||
|
body2.transform.localPosition = new Vector3(7, 40, 0);
|
||||||
|
}
|
||||||
|
if (selectionCount > 3)
|
||||||
|
{
|
||||||
|
body3 = LoadTitleScreenBody(eligible[indices[2]]);
|
||||||
|
body3.transform.localScale = Vector3.one * (body3.transform.localScale.x) * 0.3f;
|
||||||
|
body3.transform.localPosition = new Vector3(-5, 15, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject.Find("Scene/Background/PlanetPivot/Prefab_HEA_Campfire").SetActive(false);
|
||||||
|
GameObject.Find("Scene/Background/PlanetPivot/PlanetRoot").SetActive(false);
|
||||||
|
|
||||||
|
var lightGO = new GameObject("Light");
|
||||||
|
lightGO.transform.parent = GameObject.Find("Scene/Background").transform;
|
||||||
|
lightGO.transform.localPosition = new Vector3(-47.9203f, 145.7596f, 43.1802f);
|
||||||
|
var light = lightGO.AddComponent<Light>();
|
||||||
|
light.color = new Color(1f, 1f, 1f, 1f);
|
||||||
|
light.range = 100;
|
||||||
|
light.intensity = 0.8f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GameObject LoadTitleScreenBody(NewHorizonsBody body)
|
||||||
|
{
|
||||||
|
Logger.Log($"Displaying {body.Config.Name} on the title screen");
|
||||||
|
GameObject titleScreenGO = new GameObject(body.Config.Name + "_TitleScreen");
|
||||||
HeightMapModule heightMap = new HeightMapModule();
|
HeightMapModule heightMap = new HeightMapModule();
|
||||||
var minSize = 20;
|
var minSize = 20;
|
||||||
var maxSize = 35;
|
var maxSize = 35;
|
||||||
@ -206,19 +261,15 @@ namespace NewHorizons
|
|||||||
heightMap.HeightMap = body.Config.HeightMap.HeightMap;
|
heightMap.HeightMap = body.Config.HeightMap.HeightMap;
|
||||||
heightMap.MaxHeight = size;
|
heightMap.MaxHeight = size;
|
||||||
heightMap.MinHeight = body.Config.HeightMap.MinHeight * size / body.Config.HeightMap.MaxHeight;
|
heightMap.MinHeight = body.Config.HeightMap.MinHeight * size / body.Config.HeightMap.MaxHeight;
|
||||||
flag = true;
|
|
||||||
}
|
}
|
||||||
if (body.Config.Atmosphere != null && body.Config.Atmosphere.Cloud != null)
|
if (body.Config.Atmosphere != null && body.Config.Atmosphere.Cloud != null)
|
||||||
{
|
{
|
||||||
// Hacky but whatever I just want a sphere
|
// Hacky but whatever I just want a sphere
|
||||||
size = Mathf.Clamp(body.Config.Atmosphere.Size / 10, minSize, maxSize);
|
size = Mathf.Clamp(body.Config.Atmosphere.Size / 10, minSize, maxSize);
|
||||||
heightMap.MaxHeight = heightMap.MinHeight = size+1;
|
heightMap.MaxHeight = heightMap.MinHeight = size + 1;
|
||||||
heightMap.TextureMap = body.Config.Atmosphere.Cloud;
|
heightMap.TextureMap = body.Config.Atmosphere.Cloud;
|
||||||
flag = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
HeightMapBuilder.Make(titleScreenGO, heightMap, body.Assets);
|
HeightMapBuilder.Make(titleScreenGO, heightMap, body.Assets);
|
||||||
if (body.Config.Ring != null)
|
if (body.Config.Ring != null)
|
||||||
{
|
{
|
||||||
@ -229,19 +280,10 @@ namespace NewHorizons
|
|||||||
RingBuilder.Make(titleScreenGO, newRing, body.Assets);
|
RingBuilder.Make(titleScreenGO, newRing, body.Assets);
|
||||||
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
|
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
|
||||||
}
|
}
|
||||||
GameObject.Find("Scene/Background/PlanetPivot/Prefab_HEA_Campfire").SetActive(false);
|
|
||||||
GameObject.Find("Scene/Background/PlanetPivot/PlanetRoot").SetActive(false);
|
|
||||||
titleScreenGO.transform.parent = GameObject.Find("Scene/Background/PlanetPivot/").transform;
|
titleScreenGO.transform.parent = GameObject.Find("Scene/Background/PlanetPivot/").transform;
|
||||||
titleScreenGO.transform.localPosition = Vector3.zero;
|
titleScreenGO.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
var lightGO = new GameObject("Light");
|
return titleScreenGO;
|
||||||
lightGO.transform.parent = titleScreenGO.transform.parent.parent;
|
|
||||||
lightGO.transform.localPosition = new Vector3(-47.9203f, 145.7596f, 43.1802f);
|
|
||||||
var light = lightGO.AddComponent<Light>();
|
|
||||||
light.color = new Color(1f, 1f, 1f, 1f);
|
|
||||||
light.range = 100;
|
|
||||||
light.intensity = 0.8f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
private bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
||||||
@ -480,6 +522,8 @@ namespace NewHorizons
|
|||||||
public void ChangeCurrentStarSystem(string newStarSystem)
|
public void ChangeCurrentStarSystem(string newStarSystem)
|
||||||
{
|
{
|
||||||
_currentStarSystem = newStarSystem;
|
_currentStarSystem = newStarSystem;
|
||||||
|
_isChangingStarSystem = true;
|
||||||
|
Locator.GetDeathManager().KillPlayer(DeathType.Meditation);
|
||||||
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true);
|
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PacificEngine.OW_CommonResources">
|
<Reference Include="PacificEngine.OW_CommonResources">
|
||||||
<HintPath>$(OuterWildsModsDirectory)\PacificEngine.OW_CommonResources\PacificEngine.OW_CommonResources.dll</HintPath>
|
<HintPath>$(OuterWildsModsDirectory)\PacificEngine.OW_CommonResources\PacificEngine.OW_CommonResources.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace NewHorizons.Utility
|
|||||||
|
|
||||||
public static AstroObject GetAstroObject(string name)
|
public static AstroObject GetAstroObject(string name)
|
||||||
{
|
{
|
||||||
if (name.Equals("MAP_SATELLITE"))
|
if (name.ToUpper().Replace("_", "").Equals("MAPSATELLITE"))
|
||||||
return GetAstroObject(AstroObject.Name.MapSatellite);
|
return GetAstroObject(AstroObject.Name.MapSatellite);
|
||||||
var aoName = AstroObject.StringIDToAstroObjectName(name);
|
var aoName = AstroObject.StringIDToAstroObjectName(name);
|
||||||
if(aoName == AstroObject.Name.None) aoName = AstroObject.StringIDToAstroObjectName(name.ToUpper().Replace(" ", "_"));
|
if(aoName == AstroObject.Name.None) aoName = AstroObject.StringIDToAstroObjectName(name.ToUpper().Replace(" ", "_"));
|
||||||
|
|||||||
51
NewHorizons/Utility/RandomUtility.cs
Normal file
51
NewHorizons/Utility/RandomUtility.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Utility
|
||||||
|
{
|
||||||
|
public static class RandomUtility
|
||||||
|
{
|
||||||
|
public static int[] GetUniqueRandomArray(int min, int max, int count)
|
||||||
|
{
|
||||||
|
int[] result = new int[count];
|
||||||
|
List<int> numbersInOrder = new List<int>();
|
||||||
|
for (var x = min; x < max; x++)
|
||||||
|
{
|
||||||
|
numbersInOrder.Add(x);
|
||||||
|
}
|
||||||
|
for (var x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
var randomIndex = UnityEngine.Random.Range(0, numbersInOrder.Count);
|
||||||
|
result[x] = numbersInOrder[randomIndex];
|
||||||
|
numbersInOrder.RemoveAt(randomIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Vector3> FibonacciSphere(int samples)
|
||||||
|
{
|
||||||
|
List<Vector3> points = new List<Vector3>();
|
||||||
|
|
||||||
|
var phi = Mathf.PI * (3f - Mathf.Sqrt(5f));
|
||||||
|
|
||||||
|
for (int i = 0; i < samples; i++)
|
||||||
|
{
|
||||||
|
var y = 1 - (i / (float)(samples - 1)) * 2f;
|
||||||
|
var radius = Mathf.Sqrt(1 - y * y);
|
||||||
|
|
||||||
|
var theta = phi * i;
|
||||||
|
|
||||||
|
var x = Mathf.Cos(theta) * radius;
|
||||||
|
var z = Mathf.Sin(theta) * radius;
|
||||||
|
|
||||||
|
points.Add(new Vector3(x, y, z));
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user