//Sets the image of the loading screen.
        public void Start()
        {
            Debug.Log("Entering Loading Screen: " + E.Get().CurrTrial.TrialID);
            var filePath = DataSingleton.GetData().SpritesPath + E.Get().CurrTrial.trialData.FileLocation;

            GetComponent <RawImage>().texture = Img2Sprite.LoadTexture(filePath);
        }
Beispiel #2
0
        private void Start()
        {
            try
            {
                var trialText   = GameObject.Find("TrialText").GetComponent <Text>();
                var blockText   = GameObject.Find("BlockText").GetComponent <Text>();
                var currBlockId = E.Get().CurrTrial.BlockID;
                // This section sets the text
                trialText.text = E.Get().CurrTrial.trialData.DisplayText;
                blockText.text = DS.GetData().Blocks[currBlockId].DisplayText;

                if (!string.IsNullOrEmpty(E.Get().CurrTrial.trialData.DisplayImage))
                {
                    var filePath     = DS.GetData().SpritesPath + E.Get().CurrTrial.trialData.DisplayImage;
                    var displayImage = GameObject.Find("DisplayImage").GetComponent <RawImage>();
                    displayImage.enabled = true;
                    displayImage.texture = Img2Sprite.LoadTexture(filePath);
                }
            }
            catch (NullReferenceException e)
            {
                Debug.LogWarning("Goal object not set: running an instructional trial");
            }

            Random.InitState(DateTime.Now.Millisecond);

            _currDelay = 0;

            // Choose a random starting angle if the value is not set in config
            if (E.Get().CurrTrial.trialData.StartFacing == -1)
            {
                _iniRotation = Random.Range(0, 360);
            }
            else
            {
                _iniRotation = E.Get().CurrTrial.trialData.StartFacing;
            }



            transform.Rotate(0, _iniRotation, 0);

            try
            {
                _controller = GetComponent <CharacterController>();
                _gen        = GameObject.Find("WallCreator").GetComponent <GenerateGenerateWall>();
                Cam.transform.Rotate(0, 0, 0);
            }
            catch (NullReferenceException e)
            {
                Debug.LogWarning("Can't set controller object: running an instructional trial");
            }
            _waitTime  = E.Get().CurrTrial.trialData.Rotate;
            _reset     = false;
            localQuota = E.Get().CurrTrial.trialData.Quota;

            // This has to happen here for output to be aligned properly
            TrialProgress.GetCurrTrial().TrialProgress.TrialNumber++;
            TrialProgress.GetCurrTrial().TrialProgress.Instructional = TrialProgress.GetCurrTrial().trialData.Instructional;
            TrialProgress.GetCurrTrial().TrialProgress.EnvironmentType = TrialProgress.GetCurrTrial().trialData.Scene;
            TrialProgress.GetCurrTrial().TrialProgress.CurrentEnclosureIndex = TrialProgress.GetCurrTrial().trialData.Enclosure - 1;
            TrialProgress.GetCurrTrial().TrialProgress.BlockID = TrialProgress.GetCurrTrial().BlockID;
            TrialProgress.GetCurrTrial().TrialProgress.TrialID = TrialProgress.GetCurrTrial().TrialID;
            TrialProgress.GetCurrTrial().TrialProgress.TwoDim = TrialProgress.GetCurrTrial().trialData.TwoDimensional;
            TrialProgress.GetCurrTrial().TrialProgress.LastX = TrialProgress.GetCurrTrial().TrialProgress.TargetX;
            TrialProgress.GetCurrTrial().TrialProgress.LastY = TrialProgress.GetCurrTrial().TrialProgress.TargetY;
            TrialProgress.GetCurrTrial().TrialProgress.TargetX = 0;
            TrialProgress.GetCurrTrial().TrialProgress.TargetY = 0;

            _isStarted = true;
        }