Merge branch 'dev' of github.com:xen-42/outer-wilds-new-horizons into dev

This commit is contained in:
FreezeDriedMangoes 2022-07-15 08:58:05 -04:00
commit 0e7798e904
3 changed files with 10 additions and 25 deletions

View File

@ -254,7 +254,9 @@ namespace NewHorizons.Builder.Body
fog._fogDensity *= scale; fog._fogDensity *= scale;
var volumesShape = volumes.FindChild("ZeroG_Fluid_Audio_Volume"); var volumesShape = volumes.FindChild("ZeroG_Fluid_Audio_Volume");
volumesShape.GetComponent<SphereShape>().radius *= scale; var sphereShape = volumesShape.GetComponent<SphereShape>();
sphereShape.enabled = true; // this starts disabled for some fucking reason
sphereShape.radius *= scale;
// Change fog color // Change fog color
if (body.Config.Bramble.dimension.fogTint != null) if (body.Config.Bramble.dimension.fogTint != null)

View File

@ -45,31 +45,25 @@ namespace NewHorizons.Builder.Props
private static void InitPrefabs() private static void InitPrefabs()
{ {
// Just take every scroll and get the first arc // Just take every scroll and get the first arc
var existingArcs = GameObject.FindObjectsOfType<ScrollItem>().Select(x => x?._nomaiWallText?.gameObject?.transform?.Find("Arc 1")?.gameObject).Where(x => x != null).ToArray(); var arcs = GameObject.FindObjectsOfType<ScrollItem>().Select(x => x?._nomaiWallText?.gameObject?.transform?.Find("Arc 1")?.gameObject).Where(x => x != null).ToArray();
_arcPrefabs = new List<GameObject>(); _arcPrefabs = new List<GameObject>();
_childArcPrefabs = new List<GameObject>(); _childArcPrefabs = new List<GameObject>();
foreach (var existingArc in existingArcs) foreach (var arc in arcs)
{ {
if (existingArc.GetComponent<MeshRenderer>().material.name.Contains("Child")) if (arc.GetComponent<MeshRenderer>().material.name.Contains("Child"))
{ {
var arc = existingArc.InstantiateInactive();
arc.name = "Arc (Child)";
_childArcPrefabs.Add(arc); _childArcPrefabs.Add(arc);
} }
else else
{ {
var arc = existingArc.InstantiateInactive();
arc.name = "Arc";
_arcPrefabs.Add(arc); _arcPrefabs.Add(arc);
} }
} }
var existingGhostArcs = GameObject.FindObjectsOfType<GhostWallText>().Select(x => x?._textLine?.gameObject).Where(x => x != null).ToArray(); var ghostArcs = GameObject.FindObjectsOfType<GhostWallText>().Select(x => x?._textLine?.gameObject).Where(x => x != null).ToArray();
_ghostArcPrefabs = new List<GameObject>(); _ghostArcPrefabs = new List<GameObject>();
foreach (var existingArc in existingGhostArcs) foreach (var arc in ghostArcs)
{ {
var arc = existingArc.InstantiateInactive();
arc.name = "Arc";
_ghostArcPrefabs.Add(arc); _ghostArcPrefabs.Add(arc);
} }

View File

@ -26,8 +26,6 @@ namespace NewHorizons.Handlers
public Sprite eoteSprite; public Sprite eoteSprite;
public int subtitleIndex; public int subtitleIndex;
public System.Random randomizer;
public static readonly int PAUSE_TIMER_MAX = 50; public static readonly int PAUSE_TIMER_MAX = 50;
public int pauseTimer = PAUSE_TIMER_MAX; public int pauseTimer = PAUSE_TIMER_MAX;
@ -45,8 +43,6 @@ namespace NewHorizons.Handlers
public void Start() public void Start()
{ {
randomizer = new System.Random();
GetComponent<CanvasGroup>().alpha = 1; GetComponent<CanvasGroup>().alpha = 1;
graphic = GetComponent<Graphic>(); graphic = GetComponent<Graphic>();
image = GetComponent<UnityEngine.UI.Image>(); image = GetComponent<UnityEngine.UI.Image>();
@ -87,7 +83,7 @@ namespace NewHorizons.Handlers
possibleSubtitles.Add(sprite); possibleSubtitles.Add(sprite);
} }
public void Update() public void FixedUpdate()
{ {
CheckForEOTE(); CheckForEOTE();
@ -132,14 +128,7 @@ namespace NewHorizons.Handlers
public void ChangeSubtitle() public void ChangeSubtitle()
{ {
// to pick a new random subtitle without requiring retries, we generate a random offset less than the length of the possible subtitles array subtitleIndex = (subtitleIndex + 1) % possibleSubtitles.Count;
// we then add that offset to the current index, modulo NUMBER_OF_POSSIBLE_SUBTITLES
// since the offset can never be NUMBER_OF_POSSIBLE_SUBTITLES, it will never wrap all the way back around to the initial subtitleIndex
// note, this makes the code more confusing, but Random.Next(min, max) generates a random number on the range [min, max)
// that is, the below code will generate numbers up to and including Count-1, not Count.
var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count);
subtitleIndex = (subtitleIndex + newIndexOffset) % possibleSubtitles.Count;
image.sprite = possibleSubtitles[subtitleIndex]; image.sprite = possibleSubtitles[subtitleIndex];
} }