public IObservable <Unit> ChangeScene(ILoadableScene scene) { return(this.EndCurrentScene() .Concat(this.SceneManager.LoadScene(scene.GetMainScene()).Select(_ => new Unit())) .Concat(scene.Load()) .Concat(Observable.Start(() => this.SetCurrentScene(scene), Scheduler.MainThread))); }
void SetCurrentScene(ILoadableScene scene) { this.currentScene = scene; this.currentScene.Start(); }