various fixes; added material setting, and fixed some sizes

This commit is contained in:
FreezeDriedMangoes 2022-12-31 23:13:21 -05:00
parent e705c9bdc6
commit f33a65deaa
3 changed files with 33 additions and 30 deletions

View File

@ -11,9 +11,9 @@ namespace NewHorizons.Builder.Props
private static int MAX_MOVE_DISTANCE = 2;
public float maxX = 4;
public float minX = -4;
public float maxY = 5f;
public float maxX = 3;
public float minX = -3;
public float maxY = 2f;
public float minY = -1f;
public static SpiralManipulator Place(NomaiTextArcBuilder.SpiralProfile profile, GameObject spiralMeshHolder) {
@ -91,7 +91,8 @@ namespace NewHorizons.Builder.Props
return new Vector2Int(-1, -1);
}
public void Step() {
public void Step()
{
// TODO: after setting child position on parent in Step(), check to see if this spiral exits the bounds - if so, move it away until it no longer does
// this ensures that a spiral can never be outside the bounds, it makes them rigid

View File

@ -25,6 +25,7 @@ namespace NewHorizons.Builder.Props
public static GameObject BuildSpiralGameObject(SpiralProfile profile, string goName="New Nomai Spiral")
{
var g = new GameObject(goName);
g.SetActive(false);
g.transform.localPosition = Vector3.zero;
g.transform.localEulerAngles = Vector3.zero;
@ -70,16 +71,18 @@ namespace NewHorizons.Builder.Props
.Select((compiled) =>
Quaternion.Euler(-90, 0, 0) * Quaternion.Euler(0, ang, 0) * (new Vector3(compiled.x, 0, compiled.y)) // decompile them, rotate them by ang, and then rotate them to be vertical, like the base game spirals are
)
.ToList();
.ToArray();
owNomaiTextLine._lengths = _points.Take(_points.Count()-1).Select((point, i) => Vector3.Distance(point, _points[i+1])).ToArray();
owNomaiTextLine._totalLength = owNomaiTextLine._lengths.Aggregate(0f, (acc, length) => acc + length);
owNomaiTextLine._points = _points;
//owNomaiTextLine._lengths = _points.Take(_points.Count()-1).Select((point, i) => Vector3.Distance(point, _points[i+1])).ToArray();
//owNomaiTextLine._totalLength = owNomaiTextLine._lengths.Aggregate(0f, (acc, length) => acc + length);
owNomaiTextLine._state = NomaiTextLine.VisualState.UNREAD;
owNomaiTextLine._textLineLocation = NomaiText.Location.UNSPECIFIED;
owNomaiTextLine._center = _points.Aggregate(Vector3.zero, (acc, point) => acc + point) / (float)_points.Count();
owNomaiTextLine._radius = _points.Aggregate(0f, (acc, point) => Mathf.Max(Vector3.Distance(owNomaiTextLine._center, point), acc));
//owNomaiTextLine._center = _points.Aggregate(Vector3.zero, (acc, point) => acc + point) / (float)_points.Count();
//owNomaiTextLine._radius = _points.Aggregate(0f, (acc, point) => Mathf.Max(Vector3.Distance(owNomaiTextLine._center, point), acc));
owNomaiTextLine._active = true;
g.SetActive(true);
return g;
}
@ -112,7 +115,7 @@ namespace NewHorizons.Builder.Props
b = new Vector2(0.3f, 0.6f),
startS = new Vector2(342.8796f, 342.8796f),
endS = new Vector2(0, 50f),
skeletonScale = new Vector2(0.01f, 0.01f),
skeletonScale = 0.75f * new Vector2(0.01f, 0.01f),
numSkeletonPoints = 51,
innerWidth = 0.001f,
@ -127,7 +130,7 @@ namespace NewHorizons.Builder.Props
b = new Vector2(0.305f, 0.4f),
startS = new Vector2(342.8796f, 342.8796f),
endS = new Vector2(16f, 60f),
skeletonScale = new Vector2(0.002f, 0.005f),
skeletonScale = 0.75f * new Vector2(0.002f, 0.005f),
numSkeletonPoints = 51,
innerWidth = 0.001f/10f,

View File

@ -16,7 +16,9 @@ namespace NewHorizons.Builder.Props
{
public static class NomaiTextBuilder
{
private static List<GameObject> _ghostArcPrefabs;
private static Material _ghostArcMaterial;
private static Material _adultArcMaterial;
private static Material _childArcMaterial;
private static GameObject _scrollPrefab;
private static GameObject _computerPrefab;
private static GameObject _preCrashComputerPrefab;
@ -41,8 +43,6 @@ namespace NewHorizons.Builder.Props
if (!conversationInfoToCorrespondingSpawnedGameObject.ContainsKey(convo)) return null;
return conversationInfoToCorrespondingSpawnedGameObject[convo];
}
public static List<GameObject> GetGhostArcPrefabs() { return _ghostArcPrefabs; }
private static bool _isInit;
@ -52,18 +52,18 @@ namespace NewHorizons.Builder.Props
_isInit = true;
if (_ghostArcPrefabs == null)
if (_adultArcMaterial == null)
{
var existingGhostArcs = GameObject.FindObjectsOfType<GhostWallText>()
.Select(x => x?._textLine?.gameObject)
.Where(x => x != null)
.OrderBy(x => x.transform.GetPath()) // order by path so game updates dont break things
.ToArray();
_ghostArcPrefabs = new List<GameObject>();
foreach (var existingArc in existingGhostArcs)
{
_ghostArcPrefabs.Add(existingArc.InstantiateInactive().Rename("Arc (Ghost)").DontDestroyOnLoad());
}
_adultArcMaterial = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_Crossroads/Interactables_Crossroads/Trailmarkers/Prefab_NOM_BH_Cairn_Arc (2)/Props_TH_ClutterSmall/Arc_Short/Arc")
.GetComponent<MeshRenderer>()
.sharedMaterial;
}
if (_ghostArcMaterial == null)
{
_ghostArcMaterial = SearchUtilities.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Interactables_Zone1/Props_IP_ZoneSign_1/Arc_TestAlienWriting/Arc 1")
.GetComponent<MeshRenderer>()
.sharedMaterial;
}
if (_scrollPrefab == null) _scrollPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District2/Interactables_HangingCity_District2/Prefab_NOM_Scroll").InstantiateInactive().Rename("Prefab_NOM_Scroll").DontDestroyOnLoad();
@ -644,7 +644,6 @@ namespace NewHorizons.Builder.Props
arranger.AttemptOverlapResolution(overlap);
for(var a = 0; a < 10; a++) arranger.Step();
}
Logger.LogError("Overlap resolution failed!");
}
@ -658,16 +657,16 @@ namespace NewHorizons.Builder.Props
{
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Child:
profile = NomaiTextArcBuilder.childSpiralProfile;
// TODO: set mat
mat = _childArcMaterial;
break;
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Stranger when _ghostArcPrefabs.Any():
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Stranger when _ghostArcMaterial != null:
profile = NomaiTextArcBuilder.strangerSpiralProfile;
// TODO: set mat
mat = _ghostArcMaterial;
break;
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Adult:
default:
profile = NomaiTextArcBuilder.adultSpiralProfile;
// TODO: set mat
mat = _adultArcMaterial;
break;
}