mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-11 09:38:48 +00:00
25 lines
779 B
C#
25 lines
779 B
C#
|
using UnityEngine;
|
|||
|
|
|||
|
namespace QSB.ElevatorSync
|
|||
|
{
|
|||
|
public class ElevatorManager : MonoBehaviour
|
|||
|
{
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
QSB.Helper.Events.Subscribe<Elevator>(OWML.Common.Events.AfterAwake);
|
|||
|
QSB.Helper.Events.Event += OnEvent;
|
|||
|
|
|||
|
QSB.Helper.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(ElevatorPatches.StartLift));
|
|||
|
}
|
|||
|
|
|||
|
private void OnEvent(MonoBehaviour behaviour, OWML.Common.Events ev)
|
|||
|
{
|
|||
|
if (behaviour is Elevator elevator && ev == OWML.Common.Events.AfterAwake)
|
|||
|
{
|
|||
|
var elevatorController = gameObject.AddComponent<ElevatorController>();
|
|||
|
elevatorController.Init(elevator);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|