39 lines
1.0 KiB
C#
Raw Normal View History

2022-02-01 08:58:52 +00:00
using QSB.Utility;
using QSB.WorldSync;
2021-12-23 11:37:37 +00:00
using System.Linq;
using UnityEngine;
2022-03-02 19:46:33 -08:00
namespace QSB.EyeOfTheUniverse.GalaxyMap;
internal class GalaxyMapManager : MonoBehaviour, IAddComponentOnStart
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
public static GalaxyMapManager Instance { get; private set; }
2021-12-23 11:37:37 +00:00
2022-05-13 22:38:06 +01:00
public CustomDialogueTree Tree { get; private set; }
2022-03-02 19:46:33 -08:00
private void Awake()
{
Instance = this;
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
}
2021-12-23 11:37:37 +00:00
2022-03-02 19:46:33 -08:00
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
{
if (newScene != OWScene.EyeOfTheUniverse)
{
2022-03-02 19:46:33 -08:00
return;
}
2022-05-03 08:48:24 +01:00
var mapController = QSBWorldSync.GetUnityObject<GalaxyMapController>();
2022-03-02 19:46:33 -08:00
var map = mapController._interactVolume.gameObject;
2021-12-23 11:37:37 +00:00
2022-03-02 19:46:33 -08:00
map.SetActive(false);
2022-05-13 22:38:06 +01:00
Tree = map.AddComponent<CustomDialogueTree>();
2022-03-02 19:46:33 -08:00
Tree._xmlCharacterDialogueAsset = QSBCore.TextAssetsBundle.LoadAsset<TextAsset>("Assets/TextAssets/GalaxyMap.txt");
Tree._attentionPoint = map.transform;
Tree._attentionPointOffset = new Vector3(0, 1, 0);
Tree._turnOffFlashlight = true;
Tree._turnOnFlashlight = true;
map.SetActive(true);
2021-12-23 11:37:37 +00:00
}
}