コード例 #1
0
        public IEnumerator ProgrammCreateComponents(Action <GameComponents> callBack, Transform root)
        {
            Time.timeScale = 0;

            //show loading screen
            loadingScreen.gameObject.SetActive(true);

            yield return(new WaitForSecondsRealtime(0.1f));

            //Generate game level
            Level level = gameConfig.generator.Generate();

            yield return(new WaitForSecondsRealtime(0.1f));

            //Create game level
            Builder builder = new Builder(prefabs, level, root);

            Block[] blocks = builder.CreateBlocks();
            yield return(new WaitForSecondsRealtime(0.1f));

            navmeshSurface.BuildNavMesh();
            //spawn monsters

            MonsterAI[] monsters = builder.CreateCreatures();

            //Create timer
            GameObject goTimer = new GameObject("Game Timer");
            GameTimer  timer   = goTimer.AddComponent <GameTimer>();

            //Create Tag
            TagsObserver tagsObserver = new TagsObserver("Monster");

            //hide loading screen
            loadingScreen.gameObject.SetActive(false);


            GameComponents components = new GameComponents(blocks, timer, gameUI, levelGrid, rulesController, player, cameraRoot, gameConfig, tagsObserver);

            callBack(components);

            Time.timeScale = 1;
        }
コード例 #2
0
 public GameDependencyInjector(GameComponents components)
 {
     this.components = components;
 }
コード例 #3
0
 private void OnComponentsCreated(GameComponents components)
 {
     dependencyInjector = new GameDependencyInjector(components);
     dependencyInjector.Inject();
 }