you gotta give a sector to SetUpStreaming

This commit is contained in:
JohnCorby 2022-07-09 16:27:17 -07:00
parent 6629d2292d
commit 8207472983
7 changed files with 10 additions and 32 deletions

View File

@ -187,8 +187,7 @@ namespace NewHorizons.Builder.Props
var path = config.isSeed ? brambleSeedPrefabPath : brambleNodePrefabPath;
var brambleNode = SearchUtilities.Find(path).InstantiateInactive();
StreamingHandler.SetUpStreaming(brambleNode);
sector.OnOccupantEnterSector += (sd) => StreamingHandler.OnOccupantEnterSector(brambleNode, sd, sector);
StreamingHandler.SetUpStreaming(brambleNode, sector);
brambleNode.transform.parent = sector.transform;
brambleNode.transform.position = go.transform.TransformPoint(config.position);

View File

@ -109,8 +109,7 @@ namespace NewHorizons.Builder.Props
prop.transform.parent = sector?.transform ?? planetGO.transform;
prop.SetActive(false);
if (sector != null) sector.OnOccupantEnterSector += (SectorDetector sd) => StreamingHandler.OnOccupantEnterSector(prop, sd, sector);
StreamingHandler.SetUpStreaming(prop);
StreamingHandler.SetUpStreaming(prop, sector);
foreach (var component in prop.GetComponents<Component>().Concat(prop.GetComponentsInChildren<Component>()))
{

View File

@ -201,8 +201,7 @@ namespace NewHorizons.Builder.Props
AddTranslation(xmlPath);
// Make sure the computer model is loaded
StreamingHandler.SetUpStreaming(computerObject);
sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(computerObject));
StreamingHandler.SetUpStreaming(computerObject, sector);
computerObject.SetActive(true);
conversationInfoToCorrespondingSpawnedGameObject[info] = computerObject;
@ -249,8 +248,7 @@ namespace NewHorizons.Builder.Props
AddTranslation(xmlPath);
// Make sure the computer model is loaded
StreamingHandler.SetUpStreaming(cairnObject);
sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(cairnObject));
StreamingHandler.SetUpStreaming(cairnObject, sector);
conversationInfoToCorrespondingSpawnedGameObject[info] = cairnObject;
break;
}
@ -281,8 +279,7 @@ namespace NewHorizons.Builder.Props
AddTranslation(xmlPath);
// Make sure the recorder model is loaded
StreamingHandler.SetUpStreaming(recorderObject);
sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(recorderObject));
StreamingHandler.SetUpStreaming(recorderObject, sector);
recorderObject.SetActive(true);

View File

@ -129,8 +129,7 @@ namespace NewHorizons.Builder.Props
// Idk why but it wants reveals to be comma delimited not a list
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
StreamingHandler.SetUpStreaming(slideReelObj);
sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(slideReelObj));
StreamingHandler.SetUpStreaming(slideReelObj, sector);
slideReelObj.SetActive(true);
}
@ -180,8 +179,7 @@ namespace NewHorizons.Builder.Props
slideCollectionContainer.slideCollection = slideCollection;
StreamingHandler.SetUpStreaming(projectorObj);
sector.OnOccupantEnterSector.AddListener((x) => StreamingHandler.SetUpStreaming(projectorObj));
StreamingHandler.SetUpStreaming(projectorObj, sector);
// Change the picture on the lens
var lens = projectorObj.transform.Find("Spotlight/Prop_IP_SingleSlideProjector/Projector_Lens").GetComponent<MeshRenderer>();

View File

@ -29,8 +29,7 @@ namespace NewHorizons.Builder.Props
raftObject.transform.position = planetGO.transform.TransformPoint(info.position);
raftObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.identity);
sector.OnOccupantEnterSector += (sd) => StreamingHandler.OnOccupantEnterSector(raftObject, sd, sector);
StreamingHandler.SetUpStreaming(raftObject);
StreamingHandler.SetUpStreaming(raftObject, sector);
var raftController = raftObject.GetComponent<RaftController>();
// Since awake already ran we have to unhook these events

View File

@ -136,8 +136,7 @@ namespace NewHorizons.Builder.Props
controller._midBone.localPosition = controller._midStartPos;
controller._topBone.localPosition = controller._topStartPos;
StreamingHandler.SetUpStreaming(tornadoGO);
sector.OnOccupantEnterSector += (sd) => StreamingHandler.SetUpStreaming(tornadoGO);
StreamingHandler.SetUpStreaming(tornadoGO, sector);
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;

View File

@ -17,23 +17,10 @@ namespace NewHorizons.Handlers
_objectCache = new Dictionary<GameObject, List<string>>();
}
public static void OnOccupantEnterSector(GameObject obj, SectorDetector sd, Sector sector)
{
SetUpStreaming(obj);
// If its too laggy put this back idk
/*
if (sector.GetOccupants().Count > 0 || sd._occupantType == DynamicOccupant.Player)
{
LoadObject(obj);
}
*/
}
/// <summary>
/// makes it so that this object's streaming stuff will be connected to the given sector
/// </summary>
public static void SetUpStreaming(GameObject obj, Sector sector = null)
public static void SetUpStreaming(GameObject obj, Sector sector)
{
List<string> assetBundles;
if (_objectCache.ContainsKey(obj))