// Use this for initialization
    void Start()
    {
        timer = 0.0f;
        //Fetches the controller for the visualization object
        controller = VisualizationObject.GetComponent(typeof(VizController)) as VizController;


        //Fetches actual text of the text game objects
        instructionTextMesh = instructText.GetComponent<TextMesh>();
	    remainingCounterTextMesh = counterText.GetComponent<TextMesh>();
        counterText.SetActive(false);

        meter = MeterObject.GetComponent<MeterController>();
        meter.SetStatus(false);

        // Initializes the logger to the singleton instance
        logger = LoggingController.Instance;

        instructionPanel.SetActive(false);
        VisualizationObject.SetActive(false);

        vizObjInitPos = VisualizationObject.transform.position;
        vizObjInitRot = VisualizationObject.transform.rotation.eulerAngles;

        headObjInitPos = head.transform.position;
        headObjInitRot = head.transform.rotation.eulerAngles;

        textArray = logger.LoadText("pilot_text");


        pilotIndex = -1;

        

        /* Block of code for generating random data sets
         * 
         * string ratios = "";
        for (int type = 1; type < 6; type++)
        {
            for (int i = 0; i < 10; i++)
            {
                int barOne, barTwo;
                System.Random rand = new System.Random();
                string[] temp;


                string tempStr = controller.GenerateBar(9, type, rand);
                Debug.Log(tempStr);
                temp = tempStr.Split('|');
                string fileName = String.Format("2D_T{0}_{1}", type, i);

                controller.WriteDataFile(fileName, temp[0]);
                barOne = Int32.Parse(temp[1]);
                barTwo = Int32.Parse(temp[2]);
                ratios += fileName + ": " + ((barOne > barTwo) ? barTwo / barOne : barOne / barTwo) + "\n";
            }
        }
        controller.WriteDataFile("ratios2D", ratios);
        */

        TextAsset templateText = Resources.Load("2D_Spec_Template") as TextAsset;
        if (templateText == null)
        {
            Debug.Log("ERROR - NULL TEMPLATE");
        }

        templateString = templateText.text.Split('|');
        
        Vector3[] transOptions = new Vector3[3];
        transOptions[0] = new Vector3(-0.5f, 0.5f, -0.5f);
        transOptions[1] = new Vector3(0.5f, 0.5f, -0.5f);
        transOptions[2] = new Vector3(0.5f, 0.5f, 0.5f);


        rotations = new Vector3[NUM_EXPERIMENTS];
        translations = new Vector3[NUM_EXPERIMENTS];
        fileNames = new string[NUM_EXPERIMENTS];

        System.Random rand = new System.Random();

        for (int i = 0; i < 30; i++)
        {
            string fileNameOne = "2D_T1_", fileNameTwo = "2D_T3_";

            int type = i % 6;
            int j = 0;

            switch (type)
            {
                case 0:
                    //curDataFile = rand.Next(19) + 1;
                    


                    rotations[i] = Vector3.zero;
                    rotations[i + 30] = Vector3.zero;

                    translations[i] = Vector3.zero;
                    translations[i + 30] = Vector3.zero; 
                    break;
                case 1:
                    rotations[i] = Vector3.zero;
                    rotations[i + 30] = Vector3.zero;


                    j = rand.Next(3);
                    translations[i] = transOptions[j];
                    translations[i + 30] = transOptions[j];
                    break;
                case 2:
                    rotations[i] = new Vector3(0, 30, 0);
                    rotations[i + 30] = new Vector3(0, 30, 0);

                    translations[i] = Vector3.zero;
                    translations[i + 30] = Vector3.zero;
                    break;
                case 3:
                    rotations[i] = new Vector3(-30, 0, 0);
                    rotations[i + 30] = new Vector3(-30, 0, 0);

                    translations[i] = Vector3.zero;
                    translations[i + 30] = Vector3.zero;
                    break;
                case 4:
                    rotations[i] = new Vector3(-30, 0, 0);
                    rotations[i + 30] = new Vector3(-30, 0, 0);
                    
                    j = rand.Next(3);
                    translations[i] = transOptions[j];
                    translations[i + 30] = transOptions[j];
                    break;
                case 5:
                    rotations[i] = new Vector3(0, 30, 0);
                    rotations[i + 30] = new Vector3(0, 30, 0);

                    j = rand.Next(3);
                    translations[i] = transOptions[j];
                    translations[i + 30] = transOptions[j];
                    break;
            }

            fileNames[i] = fileNameOne + rand.Next(20);
            fileNames[i + 30] = fileNameTwo + rand.Next(20);


        }

        if (RANDOMIZE)
        {
            Array.Sort(fileNames, RandomSort);
            for (int t = 0; t < NUM_EXPERIMENTS; t++)
            {
                Debug.Log(fileNames[t]);
            }
            Array.Sort(rotations, RandomSort);
            Array.Sort(translations, RandomSort);
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        timer = 0.0f;
        //Fetches the controller for the visualization object
        controller = VisualizationObject.GetComponent(typeof(VizController)) as VizController;

        //Fetches actual text of the text game objects
        instructionTextMesh = instructText.GetComponent <TextMesh>();

        instructionPanel.SetActive(false);
        VisualizationObject.SetActive(false);

        vizObjInitPos = VisualizationObject.transform.position;
        vizObjInitRot = VisualizationObject.transform.rotation;

        // Initializes the logger to the singleton instance
        logger = LoggingController.Instance;

        meter = MeterObject.GetComponent <MeterController>();

        textArray = logger.LoadText("tutorial_text");

        tutorialIndex = -1;



        /* Block of code for generating random data sets
         *
         * string ratios = "";
         * for (int type = 1; type < 6; type++)
         * {
         *  for (int i = 10; i < 20; i++)
         *  {
         *      int barOne, barTwo;
         *      System.Random rand = new System.Random();
         *      string[] temp;
         *
         *
         *      string tempStr = controller.GenerateBar(9, type, rand);
         *      Debug.Log(tempStr);
         *      temp = tempStr.Split('|');
         *      string fileName = String.Format("2D_T{0}_{1}", type, i);
         *
         *      controller.WriteDataFile(fileName, temp[0]);
         *      barOne = Int32.Parse(temp[1]);
         *      barTwo = Int32.Parse(temp[2]);
         *      ratios += fileName + ": " + ((barOne > barTwo) ? barTwo / barOne : barOne / barTwo) + "\n";
         *  }
         * }
         * controller.WriteDataFile("ratios2D_PilotStudies", ratios);
         */

        TextAsset templateText = Resources.Load("2D_Spec_Template") as TextAsset;

        if (templateText == null)
        {
            Debug.Log("ERROR - NULL TEMPLATE");
        }

        templateString = templateText.text.Split('|');
    }