Inheritance: SceneManager
Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        // Initialization of all UI Texts
        texts = new List <Text>()
        {
            text1, text2, text3, text4, text5, text6, text7, text8, text9, text10, text11, text12, text13, text14, text15, text16
        };
        operations = new List <Operation>();
        // Inserting all tasks in array
        operations.Add(new Operation("1. Dismantle the ball valves"));
        operations.Add(new Operation("2. Remove the backlid"));
        operations.Add(new Operation("3. Remove the screws"));
        operations.Add(new Operation("4. Remove the dosing head"));
        operations.Add(new Operation("5. Move the diaphragm forward"));
        operations.Add(new Operation("6. Remove the diaphragm"));
        operations.Add(new Operation("7. Remove the drainer"));
        operations.Add(new Operation("8. Remove the worn out o-ring"));
        operations.Add(new Operation("9. Assemble the new o-ring"));
        operations.Add(new Operation("10. Attach the drainer"));
        operations.Add(new Operation("11. Attach the diaphragm"));
        operations.Add(new Operation("12. Move the diaphragm backwards"));
        operations.Add(new Operation("13. Mount the dosing head"));
        operations.Add(new Operation("14. Place and tighten the screws"));
        operations.Add(new Operation("15. Attach the backlid"));
        operations.Add(new Operation("16. Assemble the ball valves"));

        for (int i = 0; i < 16; i++)
        {
            texts[i].text = operations[i].getName();
        }
        manager = FindObjectOfType <SceneLevelManager>();
        setCurrentTask(manager.GetComponent <SceneLevelManager>().getCurrentSceneNumber());
        focusOnTaskInStepList(manager.GetComponent <SceneLevelManager>().getCurrentSceneNumber());
    }
Esempio n. 2
0
        private static void InitScene(Scene scene)
        {
            GameWindow.Log($"Initializing scene {scene.name}");

            _scene = scene;

            _game          = FindObjectOfType <GameBase>();
            _levelSceneRef = FindObjectOfType <LevelSceneRefBase>();

            // Check if valid Scene
            if (IsValidGameScene)
            {
                _staticConfig = ReflectionHelper.GetPropertyOrField(_game, "_Config") as ConfigBase;

                _staticLevelManager = ReflectionHelper.GetPropertyOrField(_game, "_SceneLevelManager") as SceneLevelManager;
                _gameEvents         = ReflectionHelper.GetPropertyOrField(_game, "_GameEvents") as GameEvents;

                GameWindow.Log($"{scene.name} is valid Game scene.");
            }
            else if (_levelSceneRef)
            {
                GameWindow.Log($"{scene.name} Is valid Level scene.");
            }

            // Find Config and SceneLevelManager in project if not a valid game scene
            if (!IsValidGameScene)
            {
                _staticConfig       = FindInProject.AssetByType <ConfigBase>();
                _staticLevelManager = FindInProject.AssetByType <SceneLevelManager>();
            }
        }
Esempio n. 3
0
    private void Awake()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible   = true;
        enemies          = true;

        // Enforce singleton
        if (instance == null)
        {
            // If instance does not exist set this as instance
            instance = this;
        }
        else if (instance != this)
        {
            // If instance exists and it is not this one, destroy this
            // to prevent duplicates
            Destroy(gameObject);
        }
        // Prevent this being destroyed
        DontDestroyOnLoad(gameObject);

        // Assign scripts for scene and room mgmt
        sceneScript = GetComponent <SceneLevelManager>();
        roomScript  = GetComponent <RoomManager>();

        // Assign delegate stuff
        SceneManager.sceneLoaded += (scene, loadingMode) => {
            level  = SceneManager.GetActiveScene().buildIndex;
            paused = false;
            InitGame();
        };
    }
Esempio n. 4
0
        // protected TMainSceneRefBase MainSceneRef => _MainSceneRef;

        #endregion

        #region Development

    #if UNITY_EDITOR
        private void OnValidate()
        {
            if (!_Config)
            {
                Debug.Log("Config is empty. Trying to find it in Assets.");
                _Config = FindAllObjects.InEditor <TConfig>().FirstOrDefault();

                if (_Config)
                {
                    Debug.Log($"Found a Config at {AssetDatabase.GetAssetPath(_Config)}");
                }
                else
                {
                    Debug.LogError("Can't find Config for game. Please create one.");
                }
            }

            if (!_SceneLevelManager)
            {
                Debug.Log("SceneLevelManager is empty. Trying to find it in Assets.");
                _SceneLevelManager = FindAllObjects.InEditor <SceneLevelManager>().FirstOrDefault();

                if (_SceneLevelManager)
                {
                    Debug.Log($"Found a SceneLevelManager at {AssetDatabase.GetAssetPath(_SceneLevelManager)}");
                }
                else
                {
                    Debug.LogError("Can't find SceneLevelManager for game. Create one.");
                }
            }
        }
Esempio n. 5
0
 // Start is called before the first frame update
 void Start()
 {
     manager = FindObjectOfType <SceneLevelManager>();
     FindRelevantUITexts();
     texts = new List <Text>()
     {
         text1, text2, text3, text4
     };
     sceneNumber = manager.GetComponent <SceneLevelManager>().getCurrentSceneNumber();
     foreach (Text t in texts)
     {
         t.text = "";
     }
 }
Esempio n. 6
0
    private void Awake()
    {
        manager = FindObjectOfType <SceneLevelManager>();
        string[] lines     = System.IO.File.ReadAllLines(@"Assets/Data/" + Environment.MachineName + ".csv");
        var      allString = new List <string>();

        torqueScrewdriver = GameObject.Find("TorquePlaceholder");
        needleTool        = GameObject.Find("NeedleToolPlaceholder");
        initialPosTorque  = torqueScrewdriver.transform.position;
        initialPosNeedle  = needleTool.transform.position;
        sessionID         = float.Parse(sessionIDTextField.ToString());
        //if (lines[0] != null && lines.Length > 1)
        //{
        //    // Access latest sessionID
        //    string[] splitLines = Regex.Split(lines[lines.Length - 1], ";");
        //    sessionID = float.Parse(sessionIDTextField.ToString());
        //}
        //else{
        //    sessionID = 1;
        //}
        //PlayerPrefs.SetInt("SessionID", PlayerPrefs.GetInt("SessionID") + 1);
        //sessionID = PlayerPrefs.GetInt("SessionID");
        allTimes = new List <float>()
        {
            timeScene1, timeScene2, timeScene3, timeScene4, timeScene5,
            timeScene6, timeScene7, timeScene8, timeScene9, timeScene10, timeScene11,
            timeScene12, timeScene13, timeScene14, timeScene15, timeScene16
        };

        allAttemps = new List <float>()
        {
            attempsScene1, attempsScene2, attempsScene3, attempsScene4, attempsScene5,
            attempsScene6, attempsScene7, attempsScene8, attempsScene9, attempsScene10, attempsScene11,
            attempsScene12, attempsScene13, attempsScene14, attempsScene15, attempsScene16
        };
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 7
0
    void Start()
    {
        vibrate = transform.Find("/Vibration").GetComponent <VibrateController>();
        time    = new Stopwatch();
        manager = FindObjectOfType <SceneLevelManager>();
        initRot = this.transform.rotation;
        trans   = targetObject.transform;

        leftHandThumbTip = GameObject.Find("/CameraPlaceholder/LeftHand/LeftHandSkinnedMesh/hands:l_hand_world/hands:b_l_hand/hands:b_l_thumb1" +
                                           "/hands:b_l_thumb2/hands:b_l_thumb3/hands:b_l_thumb_ignore");

        rightHandThumbTip = GameObject.Find("/CameraPlaceholder/RightHand/RightHandSkinnedMesh/hands:l_hand_world/hands:b_l_hand/hands:b_l_thumb1" +
                                            "/hands:b_l_thumb2/hands:b_l_thumb3/hands:b_l_thumb_ignore");

        leftButtonObj        = GameObject.Find("LeftButtonPos");
        rightButtonObj       = GameObject.Find("RightButtonPos");
        diaphragmDestination = GameObject.Find("DiaphragmPosition");
        diaphragm            = GameObject.Find("/DetailedPump2/Diaphragm");
        audioData            = GetComponent <AudioSource>();
    }
Esempio n. 8
0
 void Awake()
 {
     // Ensure Singleton pattern, GameManager should exist only once
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
     // Assign some vars
     sceneScript = GetComponent <SceneLevelManager> ();
     level       = 0;
     // Prevent the GameManager from being destroyed when changing scenes
     DontDestroyOnLoad(gameObject);
     // Set the scene loading function
     // When changing scenes, we assign the level, unpause and initialise the game again
     SceneManager.sceneLoaded += (FindSceneObjectsOfType, loadingMode) => {
         level    = SceneManager.GetActiveScene().buildIndex;
         isPaused = false;
         InitGame();
     };
 }
 // Start is called before the first frame update
 void Start()
 {
     manager = FindObjectOfType <SceneLevelManager>();
 }
    private void Awake()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
        enemies = true;

        // Enforce singleton
        if (instance == null) {
            // If instance does not exist set this as instance
            instance = this;
        } else if (instance != this) {
            // If instance exists and it is not this one, destroy this
            // to prevent duplicates
            Destroy (gameObject);
        }
        // Prevent this being destroyed
        DontDestroyOnLoad(gameObject);

        // Assign scripts for scene and room mgmt
        sceneScript = GetComponent<SceneLevelManager>();
        roomScript = GetComponent<RoomManager>();

        // Assign delegate stuff
        SceneManager.sceneLoaded += (scene, loadingMode) => {
            level = SceneManager.GetActiveScene().buildIndex;
            paused = false;
            InitGame ();
        };
    }