static private string NameImageFile()
    {
        ExperimentSettings _expInstance  = ExperimentSettings.GetInstance();
        string             imageFileName = _expInstance.FileName + "_" + _expInstance.MazeSettings.TrialName + _expInstance.TrialTracker[_expInstance.MazeSettings.TrialName].ToString() + "_";

        if (ExperimentSettings.IsAP() ||
            ExperimentSettings.IsSPT() ||
            ExperimentSettings.IsTP())
        {
            if (_expInstance.MazeSettings.Arrows)
            {
                imageFileName += "Arrows_";
            }
        }
        if (ExperimentSettings.IsCM())
        {
            imageFileName += "Start" + _expInstance.MazeSettings.StartLocationCM + "-";
            if (!string.IsNullOrEmpty(_expInstance.MazeSettings.LandmarkGoalCM))
            {
                imageFileName += "Landmark" + _expInstance.MazeSettings.LandmarkGoalCM;
            }
        }

        imageFileName += "_path.png";

        return(imageFileName);
    }
示例#2
0
    public void OnTriggerEnter(Collider other)
    {
        Debug.Log("MazeEnd() being called due to maze completion");
        ExperimentSettings _instance = ExperimentSettings.GetInstance();

        _instance.MazeSettings.ReachedEnd = true;
        MazeController.MazeEnd();
    }
    static private List <string> GetExperimentHeader()
    {
        List <string> experimentHeader = new List <string>();

        ExperimentSettings _expInstance = ExperimentSettings.GetInstance();

        experimentHeader.Add("Participant ID: " + _expInstance.ParticipantID);
        experimentHeader.Add("Experimenter Initials: " + _expInstance.ExperimenterInitials);
        experimentHeader.Add("Date: " + _expInstance.Date);
        experimentHeader.Add("Experiment Type: " + _expInstance.ExperimentType);
        return(experimentHeader);
    }
示例#4
0
    private void Start()
    {
        _expInstance = ExperimentSettings.GetInstance();
        _expInstance.MazeSettings = new MazeSettings();

        if (!string.IsNullOrEmpty(_expInstance.ExperimenterInitials))          // if this already exists then we're coming out of a maze
        {
            OpenSubmenu();
        }
        else
        {
            PopulateDropdown();
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        ExperimentSettings _expInstance = ExperimentSettings.GetInstance();

        if (_expInstance.MazeSettings.Rotate || _expInstance.MazeSettings.Pause)
        {
            Debug.Log(gameObject.transform.position);
            MazeController.cornerTransform = gameObject.transform;
            gameObject.SetActive(false);
            //Debug.Log(gameObject.ToString());
            MazeController.onCorner    = cornerNum;
            MazeController.cornerEvent = true;
        }
    }
    static private List <string> GetExperimentInfo()
    {
        List <string>      experimentInfo = new List <string>();
        ExperimentSettings _expInstance   = ExperimentSettings.GetInstance();


        experimentInfo.Add(_expInstance.MazeSettings.TrialName + _expInstance.TrialTracker[_expInstance.MazeSettings.TrialName].ToString());
        experimentInfo.Add("Maze: " + _expInstance.MazeSettings.MazeName.ToString());
        experimentInfo.Add("Trial Number: " + _expInstance.TrialTracker[_expInstance.MazeSettings.TrialName].ToString());
        experimentInfo.Add("Experiment Type: " + _expInstance.ExperimentType);


        if (ExperimentSettings.IsAP() ||
            ExperimentSettings.IsSPT() ||
            ExperimentSettings.IsTP())
        {
            experimentInfo.Add("Arrows: " + _expInstance.MazeSettings.Arrows.ToString());
        }

        if (ExperimentSettings.IsCM())
        {
            experimentInfo.Add("CM Start Location: " + _expInstance.MazeSettings.StartLocationCM);
            if (!string.IsNullOrEmpty(_expInstance.MazeSettings.StartLocationCM))
            {
                experimentInfo.Add("CM Landmark:" + _expInstance.MazeSettings.LandmarkGoalCM);
            }
        }

        experimentInfo.Add("Distance: " + totalDistance);
        experimentInfo.Add("Time: " + totalTime);
        experimentInfo.Add("Avg. Velocity: " + avgVelocity);
        if (_expInstance.MazeSettings.ReachedEnd && _expInstance.MazeSettings.MazeName != MazeNameEnum.JP)
        {
            experimentInfo.Add("Reached End: " + _expInstance.MazeSettings.ReachedEnd.ToString());
        }
        else if (!_expInstance.MazeSettings.ReachedEnd && _expInstance.MazeSettings.MazeName != MazeNameEnum.JP)
        {
            experimentInfo.Add("Reached End: False, manual exit");
        }
        experimentInfo.Add("\r\n");


        return(experimentInfo);
    }
    void Start()
    {
        _expInstance = ExperimentSettings.GetInstance();
        InitMaze();
        totalDistance      = 0;
        totalTime          = 0;
        path               = new List <string>();
        hasEnded           = false;
        hasStarted         = false;
        picCounter         = 0;
        grabAndFaceForward = false;
        subjectInstance    = GameObject.FindWithTag("Player");
        controller         = subjectInstance.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
        controller.enabled = false;
        lastPos            = subjectInstance.transform.position;
        currentPos         = subjectInstance.transform.position;
        GameObject _goTransform = new GameObject();

        cornerTransform = _goTransform.transform;
    }
    static private void TakePhoto()
    {
        ExperimentSettings _expInstance = ExperimentSettings.GetInstance();
        Camera             cam          = GameObject.Find("Overhead Cam").GetComponent <Camera>();
        RenderTexture      currentRT    = RenderTexture.active;
        var rTex = new RenderTexture(cam.pixelHeight, cam.pixelHeight, 16);

        cam.targetTexture    = rTex;
        RenderTexture.active = cam.targetTexture;
        cam.Render();
        Texture2D tex = new Texture2D(cam.targetTexture.width, cam.targetTexture.height, TextureFormat.RGB24, false);

        tex.ReadPixels(new Rect(0, 0, cam.targetTexture.width, cam.targetTexture.height), 0, 0);
        tex.Apply(false);
        RenderTexture.active = currentRT;
        byte[] bytes = tex.EncodeToPNG();
        Destroy(tex);
        string imageFileName = NameImageFile();

        System.IO.File.WriteAllBytes(imageFileName, bytes);
    }