using AX.MessageSystem; using UnityEngine; using UniRx; public class FloorShortcuts : MonoBehaviour { public static FloorShortcuts Instance; public int CurrentNumber; public int Highest; public int Lowest; public string Buildingfilter; private void Awake() { Instance = this; } // Start is called before the first frame update void Start() { Observable.EveryLateUpdate() .Where(_ => Input.GetKeyDown(KeyCode.PageUp)) .Subscribe(_ => { if (CurrentNumber < Highest && CurrentNumber >= Lowest) { CurrentNumber++; if (CurrentNumber == 0) CurrentNumber = 1; } if (CurrentNumber == Highest) { MainMenu.Instance.OnInterialClose(); CurrentNumber = Highest; } else { MessageDispatcher.SendMessage("FLOORNUMBER", CurrentNumber, Buildingfilter); } }).AddTo(gameObject); Observable.EveryLateUpdate() .Where(_ => Input.GetKeyDown(KeyCode.PageDown)) .Subscribe(_ => { if (CurrentNumber > Lowest && CurrentNumber <= Highest) { CurrentNumber--; if (CurrentNumber == 0) CurrentNumber = -1; MessageDispatcher.SendMessage("FLOORNUMBER", CurrentNumber, Buildingfilter); } }); } }