Beispiel #1
0
        private void Awake()
        {
            _gameScenarioBase = FindObjectOfType <GameScenarioBase>();
            _gameProgress     = FindObjectOfType <GameProgress>();

            _nextSceneNumber = SceneManager.GetActiveScene().buildIndex + _nextLoadSceneNumber;
            if (_gameScenarioBase == null)
            {
                var scenario = CustomResources.Load <GameScenarioBase>
                                   (AssetsPathGameObject.GameObjects[GameObjectType.GameScenarioExecutor]);

                _gameScenarioBase = Instantiate(scenario);
                if (_gameScenarioBase == null)
                {
                    CustomDebug.LogError("GameScenarioExecutor has no scenario", this);
                    return;
                }
            }
            _gameScenarioBase.Inject(_gameProgress);

            Planner.Chain()
            .AddFunc(_gameScenarioBase.ExecuteScenario)
            .AddAction(LoadNextScene)
            ;
        }
 public void Inject(GameProgress gameProgress)
 {
     _progress = gameProgress;
 }