示例#1
0
 protected virtual void Awake()
 {
     // 登録済みの GameObject にアタッチされている全ての IObservableAwakeMonoBehaviour Component から登録
     this.PreAwakeGameObjectList.SelectMany(x => x.GetComponents <IObservableAwakeMonoBehaviour>()).ToList().ForEach(x => this.OnAwakeObservableList.Add(x.OnAwakeAsObservable()));
     // 登録済みの ObservableLifecycleMonoBehaviour Component から登録
     this.PreAwakeComponentList.ForEach(x => this.OnAwakeObservableList.Add(x.OnAwakeAsObservable()));
     // 全ての先読み MonoBehaviour の Awake() 呼び出しが完了したら処理を行う
     this.OnAwakeObservableList
     .WhenAll()
     .Subscribe(
         (_) => {
         this.OnAwake();
         Awaken.OnNext(this);
         Awaken.OnCompleted();
     }
         );
 }