using QSB.WorldSync; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace QSB.ElevatorSync { public class ElevatorManager : MonoBehaviour { public static ElevatorManager Instance { get; private set; } private List _elevators; private void Awake() { Instance = this; QSBSceneManager.OnSceneLoaded += OnSceneLoaded; QSB.Helper.HarmonyHelper.AddPostfix("StartLift", typeof(ElevatorPatches), nameof(ElevatorPatches.StartLift)); } private void OnSceneLoaded(OWScene scene, bool isInUniverse) { _elevators = Resources.FindObjectsOfTypeAll().ToList(); for (var id = 0; id < _elevators.Count; id++) { var qsbElevator = WorldRegistry.GetObject(id) ?? new QSBElevator(); qsbElevator.Init(_elevators[id], id); WorldRegistry.AddObject(qsbElevator); } } public int GetId(Elevator elevator) => _elevators.IndexOf(elevator); } }