Ejemplo n.º 1
0
 void Awake()
 {
     if (!Instance)
     {
         Instance = this;
         // init all
         InitSystems();
         // then call start
         StartSystem();
         // observer scene changes
         SceneManager.sceneLoaded += OnSceneLoaded;
         // observe screen size change
         _screenSizeChecker = new WConditional <Vector2Int>(
             new WObservable <Vector2Int>(new Vector2Int(Screen.width, Screen.height))
             );
         _screenSizeChecker.OnChange += () => OnScreenSizeChanged?.Invoke();
     }
     else
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
 private void gameWindow_ClientSizeChanged(object sender, EventArgs e)
 {
     OnScreenSizeChanged?.Invoke(sender, e);
 }