Пример #1
0
        private IEnumerator Start()
        {
            TerrainManager.CreateTerrain(Vector3.zero);

            yield return(null);

            //CameraManager.AddCamera("Default Camera 1", new Vector3(-40, 115, -138), Quaternion.Euler(30, 10, 0));
            //CameraManager.AddCamera("Default Camera 2", new Vector3(33, 70.5f, -49), Quaternion.Euler(50, -32, 0));
            //CameraManager.AddCamera("Default Camera 3", new Vector3(36.5f, 180f, 138), Quaternion.Euler(63, 230, -5f));
            CameraManager.Remove("GUI Camera");

            NPCInit.Initialize();

            UIManager.Create <HUDViewModel>().IsActive         = true;
            UIManager.Create <NPCDialogueViewModel>().IsActive = false;
            UIManager.Create <BlacksmithViewModel>().IsActive  = false;
            UIManager.Create <InGameMenuViewModel>().IsActive  = false;
            UIManager.Create <RecipeViewModel>().IsActive      = false;
            //TODO: Parametrize prefab name with a UI selector
            CodeEditorViewModel codeEditorViewModel = UIManager.Create <CodeEditorViewModel>();

            StartCoroutine(codeEditorViewModel.ToggleEditorCoroutine());

            GameObject robot = RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, 0), Quaternion.identity);

            RobotManager.ActiveRobot = robot;
            RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, 0), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, 0), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, -10), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, -10), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, -10), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, -20), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, -20), Quaternion.identity);
            RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, -20), Quaternion.identity);

            GameObject enemyManagerPrefab = Resources.Load <GameObject>("InfrastructurePrefabs/EnemyManager");

            Instantiate(enemyManagerPrefab);

            InventoryManager.Inventory = new Inventory();
            InventoryViewModel  inventoryViewModel  = UIManager.Create <InventoryViewModel>();
            ItemDialogViewModel itemDialogViewModel = UIManager.Create <ItemDialogViewModel>();

            inventoryViewModel.IsActive  = false;
            codeEditorViewModel.IsActive = false;
            itemDialogViewModel.IsActive = false;

            CameraManager.SetCameraWall();
        }
Пример #2
0
        private IEnumerator CommonInitRoutine()
        {
            UIManager.Get <BackgroundViewModel>().IsActive = false;
            StartCoroutine(PrefabPool.Instance.LoadPrefabs(prefabList));
            TerrainManager.CreateTerrain(Vector3.zero);
            CameraManager.Remove("GUI Camera");
            UIManager.Create <HUDViewModel>().IsActive         = true;
            UIManager.Create <NPCDialogueViewModel>().IsActive = false;
            UIManager.Create <BlacksmithViewModel>().IsActive  = false;
            InGameMenuViewModel inGameMenuViewModel = UIManager.Create <InGameMenuViewModel>();

            inGameMenuViewModel.IsActive = false;
            inGameMenuViewModel.ExitGameButton.onClick.AddListener(OnExit);
            NPCInit.Initialize();
            CodeEditorViewModel codeEditorViewModel = UIManager.Create <CodeEditorViewModel>();

            StartCoroutine(codeEditorViewModel.ToggleEditorCoroutine());
            codeEditorViewModel.IsActive = false;
            while (!PrefabPool.Instance.Initialized)
            {
                yield return(null);
            }
            yield return(null);
        }