private void OnSceneChange(Scene oldScene, Scene newScene) { var playerMachine = Manager.Player.GetComponent <PlayerMachine>(); if (playerMachine) { modHUD.ToggleState(true, playerMachine); } else { if (modHUD) { modHUD.ToggleState(false, null); } } if (newScene.name == "void") { Basic_NPC spectralNpc = null; var npcs = Object.FindObjectsOfType <Basic_NPC>(); foreach (var npc in npcs) { var textAsset = npc.GetComponentInChildren <TalkVolume>().Dialogue; if (DialogueUtils.GetNPCName(textAsset.text) == "Oleia") { spectralNpc = npc; var collider = npc.GetComponentInChildren <Collider>(); if (collider) { npcDistance = collider.bounds.size.x; } break; } } if (spectralNpc != null) { LogDebug("Found Spectral!"); Object.Instantiate(spectralNpc, npcPos, Quaternion.identity); } } }
private void OnSceneChange(Scene oldScene, Scene newScene) { if (newScene.name == "void") { Basic_NPC legsNpc = null; var npcs = Object.FindObjectsOfType <Basic_NPC>(); foreach (var npc in npcs) { var textAsset = npc.GetComponentInChildren <TalkVolume>().Dialogue; if (DialogueUtils.GetNPCName(textAsset.text) == "Oleia") { legsNpc = npc; var collider = npc.GetComponentInChildren <Collider>(); if (collider) { npcDistance = collider.bounds.size.x; } break; } } if (legsNpc != null) { LogDebug("Found Oleia (Legs)!"); Object.Instantiate(legsNpc, npcPos, npcRot); } levelPos.Clear(); var boxes = GameObject.FindObjectsOfType <PizzaBox>(); foreach (var box in boxes) { string level = levelStr.GetValue(box) as string; if (level != null) { levelPos[level] = box.gameObject.transform.position; } } } }