Readd copies of arc prefabs

There are still "dumb" copies of the cairns, computers and etc. So these really don't need to be removed.
This commit is contained in:
Noah Pilarski 2022-07-15 11:09:34 -04:00
parent a2ed79341a
commit 8bd04d4afc

View File

@ -45,25 +45,31 @@ 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 arcs = GameObject.FindObjectsOfType<ScrollItem>().Select(x => x?._nomaiWallText?.gameObject?.transform?.Find("Arc 1")?.gameObject).Where(x => x != null).ToArray(); var existingArcs = 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 arc in arcs) foreach (var existingArc in existingArcs)
{ {
if (arc.GetComponent<MeshRenderer>().material.name.Contains("Child")) if (existingArc.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 ghostArcs = GameObject.FindObjectsOfType<GhostWallText>().Select(x => x?._textLine?.gameObject).Where(x => x != null).ToArray(); var existingGhostArcs = GameObject.FindObjectsOfType<GhostWallText>().Select(x => x?._textLine?.gameObject).Where(x => x != null).ToArray();
_ghostArcPrefabs = new List<GameObject>(); _ghostArcPrefabs = new List<GameObject>();
foreach (var arc in ghostArcs) foreach (var existingArc in existingGhostArcs)
{ {
var arc = existingArc.InstantiateInactive();
arc.name = "Arc (Ghost)";
_ghostArcPrefabs.Add(arc); _ghostArcPrefabs.Add(arc);
} }