// Use this for initialization
        private void Start()
        {
            var initPipeline = InitPipeline.Create(graph =>
            {
                var configInitializer =
                    InitLambda.Action("InitializeConfig", InitializeConfig);
                graph.AddItem(configInitializer);
                var blockInitializer =
                    InitLambda.Action("InitializeBlockFactory",
                                      BlockFactory.Initialize);
                var blockNode = graph.AddItem(blockInitializer);
                blockNode.DependsOn(configInitializer);
                var startGame = InitLambda.Action("Start Game", StartGame);
                var startNode = graph.AddItem(startGame);
                startNode.DependsOn(configInitializer, blockInitializer);
            });

            initPipeline.OnStepCompleted += (sender, args) =>
            {
                if (args.CompletedStepName != null)
                {
                    Debug
                    .Log($"{args.CompletedStepName} {args.CompletedSteps}/{args.TotalSteps}");
                }
            };
            initPipeline.Run();
        }
Esempio n. 2
0
        //TODO : this run method is burried in callbacks for UI. Stack is _ugly_
        public void Run()
        {
            var initPipeline = InitPipeline.Create(graph =>
            {
                var generatorInitializer =
                    InitLambda.Action("InitializeGenerators",
                                      () =>
                {
                    GenerationManager
                    .Initialize(_settings.SeedValue);
                });
                graph.AddItem(generatorInitializer);
                var startGame =
                    InitLambda.Action("Start Game",
                                      () => SceneManager.LoadScene("GameWorld"));
                var startNode = graph.AddItem(startGame);
                startNode.DependsOn(generatorInitializer);
            });

            initPipeline.OnStepCompleted += (sender, args) =>
            {
                if (args.CompletedStepName != null)
                {
                    Debug
                    .Log($"{args.CompletedStepName} {args.CompletedSteps}/{args.TotalSteps}");
                }
            };
            initPipeline.Run();
        }