2020-08-21 13:04:13 +00:00
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
using System.Collections.Generic;
|
2020-08-13 18:43:47 +00:00
|
|
|
|
using UnityEngine;
|
2020-08-12 20:22:52 +00:00
|
|
|
|
|
|
|
|
|
namespace QSB.ElevatorSync
|
|
|
|
|
{
|
2020-12-02 21:23:01 +00:00
|
|
|
|
public class ElevatorManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static ElevatorManager Instance { get; private set; }
|
2020-08-13 18:43:47 +00:00
|
|
|
|
|
2020-12-02 21:23:01 +00:00
|
|
|
|
private List<Elevator> _elevators;
|
2020-08-13 18:43:47 +00:00
|
|
|
|
|
2020-12-14 20:41:56 +00:00
|
|
|
|
public void Awake()
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
|
|
|
|
}
|
2020-08-12 20:22:52 +00:00
|
|
|
|
|
2020-12-14 20:41:56 +00:00
|
|
|
|
public void OnDestroy() => QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
2020-11-25 09:54:52 +00:00
|
|
|
|
|
2020-12-24 08:06:23 +00:00
|
|
|
|
private void OnSceneLoaded(OWScene scene, bool isInUniverse) => _elevators = QSBWorldSync.Init<QSBElevator, Elevator>();
|
2020-08-13 18:43:47 +00:00
|
|
|
|
|
2020-12-02 21:23:01 +00:00
|
|
|
|
public int GetId(Elevator elevator) => _elevators.IndexOf(elevator);
|
|
|
|
|
}
|
2020-12-03 08:28:05 +00:00
|
|
|
|
}
|