Ejemplo n.º 1
0
 private static void methode(CoOrds c)
 {
     Console.WriteLine("Avant reaffectation " + c);
     c.x = 100;
     c.y = 200;
     Console.WriteLine("Après reaffectation " + c);
 }
Ejemplo n.º 2
0
 public void GetNextTile(CoOrds refTile)
 {
     if (l_x == t_x)                                              // Move up or down only
     {
         if (l_y < t_y)
         {
             GetTileCoOrds(refTile, (int)Movement.UP);            // TileNum above
         }
         else
         {
             GetTileCoOrds(refTile, (int)Movement.DOWN);          // TileNum below
         }
     }
     else if (l_x > t_x)                                          // Move left
     {
         if (l_y > t_y)
         {
             GetTileCoOrds(refTile, (int)Movement.DOWN_LEFT);
         }
         else
         {
             GetTileCoOrds(refTile, (int)Movement.UP_LEFT);
         }
     }
     else if (l_y > t_y)                                          // Move Right
     {
         GetTileCoOrds(refTile, (int)Movement.DOWN_RIGHT);
     }
     else
     {
         GetTileCoOrds(refTile, (int)Movement.UP_RIGHT);
     }
 }
Ejemplo n.º 3
0
    /* Spawn trigger points until 1 plane is completed */
    public void HotSpotTriggerInstantiate()
    {
        /* check if user has tapped first point */
        if (itr == 1)
        {
            // Begin timing
            stopwatch.Start();
        }

        CoOrds coords_temp = new CoOrds();

        /* Spawn trigger points */
        if (itr < coOrds_collection[order[trial]].Count)
        {
            coords_temp = coOrds_collection[order[trial]] [itr];
            Transform trigger = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            trigger.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
            itr++;
        }

        /* Trial is completed */
        else
        {
            // Stop timing
            System.TimeSpan ts = stopwatch.Elapsed;
            stopwatch.Stop();
            UnityEngine.Debug.Log("Time elapsed: " + ts);
            stopwatch.Reset();

            // Write time to file
            File.WriteAllText(@path, ts.ToString());
        }
    }
    static void Main()
    {
        CoOrds myCoOrds = new CoOrds(10, 15);
                myCoOrds.PrintCoOrds();

                // Keep the console window open in debug mode.
                Console.WriteLine("Press any key to exit.");
                Console.ReadKey();
    }
Ejemplo n.º 5
0
    static void Main()
    {
        CoOrds myCoOrds = new CoOrds(10, 15);

        myCoOrds.PrintCoOrds();

        // Keep the console window open in debug mode.
        Console.WriteLine("Press any key to exit.");
        Console.ReadKey();
    }
Ejemplo n.º 6
0
        public void RaiseInvalidOperationExceptionForBadGetValuePosition(int x, int y)
        {
            // Arrange
            CoOrds testPosition = new CoOrds(x, y);

            // Assert
            var ex = Assert.Throws <InvalidOperationException>(() => _runtime.GetValue(testPosition));

            Assert.Equal(ex.Message, $"Invalid Position specified: [{x},{y}].");
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            item   p1 = new item();
            CoOrds p2 = new CoOrds(5, 3);

            // Display the results using the overriden ToString method:
            Console.WriteLine("CoOrds #1 at {0}", p1);
            Console.WriteLine("CoOrds #2 at {0}", p2);
            Console.ReadKey();
        }
    static void Main()
    {
        CoOrds p1 = new CoOrds();
                CoOrds p2 = new CoOrds(5, 3);

                // Display the results using the overriden ToString method:
                Console.WriteLine("CoOrds #1 at {0}", p1);
                Console.WriteLine("CoOrds #2 at {0}", p2);
                Console.ReadKey();
    }
Ejemplo n.º 9
0
        public void PutAndGetCorrectValue()
        {
            // Arrange
            var putPosition = new CoOrds(1, 1);

            // Act
            _runtime.PutValue(putPosition, 'X');


            // Assert
            Assert.Equal('X', _runtime.GetValue(putPosition));
        }
Ejemplo n.º 10
0
    static void Main()
    {
        CoOrds c = new CoOrds(1, 2);

        CoOrds c2;

        c2.x = 2;
        //c2.y = 3;

        System.Console.WriteLine(c.GetType());
        System.Console.WriteLine(c2.x);
        System.Console.ReadLine();
    }
Ejemplo n.º 11
0
            static void Main()
            {
                //<Snippet77>
                CoOrds p1 = new CoOrds();
                CoOrds p2 = new CoOrds(5, 3);

                //</Snippet77>

                // Display the results using the overriden ToString method:
                Console.WriteLine("CoOrds #1 at {0}", p1);
                Console.WriteLine("CoOrds #2 at {0}", p2);
                Console.ReadKey();
            }
Ejemplo n.º 12
0
        public void Run()
        {
            // Read each line in the text and write to string list
            String[] moves = null;
            using (StreamReader sr = new StreamReader("Day1Input.txt"))
            {
                List <string> inputs = new List <string>();
                while (sr.Peek() >= 0)
                {
                    inputs.Add(sr.ReadLine());
                }
                foreach (string input in inputs)
                {
                    string[] inputSplit = { ", " };
                    moves = input.Split(inputSplit, StringSplitOptions.RemoveEmptyEntries);
                }
            }

            // stops stores the coordinates we pass through between start and the Easter Bunny HQ
            // currentStop is the location we are currently at
            // dir is a numerical representation for the direction we are facing
            // easterHQ is the coordinates for the Easter Bunny HQ for part 2
            // ebFound is a bool telling us if we've found the location of easterHQ as per part 2
            // the Regexs are for spitting the turns and steps from each set of moves
            List <CoOrds> stops       = new List <CoOrds>();
            CoOrds        currentStop = new CoOrds();
            int           dir         = 0;

            currentStop.x = 0;
            currentStop.y = 0;
            CoOrds easterHQ  = new CoOrds();
            bool   ebFound   = false;
            Regex  letterRgx = new Regex(@"\d");
            Regex  numberRgx = new Regex(@"\D");

            foreach (var move in moves)
            {
                string direction      = letterRgx.Replace(move, String.Empty);
                string stringDistance = numberRgx.Replace(move, String.Empty);
                int    distance       = int.Parse(stringDistance);
                dir = rotate(dir, direction);

                var restults = walk(distance, stops, currentStop, easterHQ, dir, ebFound);
                currentStop = restults.Item1;
                easterHQ    = restults.Item2;
                ebFound     = restults.Item3;
            }
            Console.WriteLine("Full Path distance away from start: {0}", Math.Abs(currentStop.x) + Math.Abs(currentStop.y));
            Console.WriteLine("Easter Bunny HQ distance: {0}", Math.Abs(easterHQ.x) + Math.Abs(easterHQ.y));
        }
Ejemplo n.º 13
0
    static void Main()
    {
        CoOrds coords1 = new CoOrds();
        CoOrds coords2 = new CoOrds(5, 6);

        Console.Write("CoOrds 1: ");
        Console.WriteLine("X = {0}, y = {1}", coords1.x, coords2.y);

        Console.Write("CoOrds 2: ");
        Console.WriteLine("X = {0}, y = {1}", coords1.x, coords2.y);

        Console.WriteLine("Press any key to exit.");
        Console.ReadKey();
    }
Ejemplo n.º 14
0
    void Start()
    {
        board = new Board(xSize, ySize);

        for (int i = 0; i < xSize; i++)
        {
            for (int j = 0; j < ySize; j++)
            {
                CoOrds     co = new CoOrds(i, j);
                Vector3    v  = board.GetPosition(co);
                GameObject go = Instantiate(boardTile, v, Quaternion.identity, boardContainer);
                go.name = "Tile (" + i + ", " + j + ")";
            }
        }
    }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            //Initialize:
            CoOrds coords1 = new CoOrds();
            CoOrds coords2 = new CoOrds(10, 10);

            //Display results
            Console.Write("CoOrds 1 :");
            Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);

            Console.Write("CoOrds 2 :");
            Console.WriteLine("x = {0}, y = {1}", coords2.x, coords2.y);

            Console.ReadKey();
        }
    /* Generate circular arrays of static points */
    public void initializeCoordinates(ref int[] order, ref List <List <CoOrds> > coOrds_collection, ref List <CoOrds> coOrds_collection_2)
    {
        int    i;
        int    temp;
        CoOrds temp_vector;
        int    random_placeholder;
        int    numberOfObjects = 18;

        /* z = 0.3 frame */
        for (i = 0; i < numberOfObjects; i++)
        {
            float  angle = i * Mathf.PI * 2 / numberOfObjects;
            CoOrds pos   = new CoOrds(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 0.3f, "middle");
            coOrds_collection_2.Add(pos);
        }

        /* Shuffle */
        for (i = 0; i < numberOfObjects; i++)
        {
            random_placeholder = i + Random.Range(0, numberOfObjects - i);

            /* Swap */
            temp_vector            = coOrds_collection_2[i];
            coOrds_collection_2[i] = coOrds_collection_2[random_placeholder];
            coOrds_collection_2[random_placeholder] = temp_vector;
        }

        /* Add plane to entire collection */
        coOrds_collection.Add(coOrds_collection_2);

        /* Trial counters */

        /*
         * CoOrds counter_1 = new CoOrds(0.71f, 0.5f, 0.0f, null);
         * counter_collection.Add(counter_1);
         * CoOrds counter_2 = new CoOrds(0.81f, 0.5f, 0.0f, null);
         * counter_collection.Add(counter_2);
         * CoOrds counter_3 = new CoOrds(0.91f, 0.5f, 0.0f, null);
         * counter_collection.Add(counter_3);
         */

        /* Spawn initial static points */
        for (i = 0; i < numberOfObjects; i++)
        {
            temp_vector = coOrds_collection[order[trial]] [i];
            Transform static_pt = Instantiate(static_point, new Vector3(temp_vector.x, temp_vector.y, temp_vector.z), Quaternion.identity, this.transform);              // Make this gameObject the parent
        }
    }
    static void Main()
    {
        // Initialize:
            CoOrds coords1 = new CoOrds();
            CoOrds coords2 = new CoOrds(10, 10);

            // Display results:
            Console.Write("CoOrds 1: ");
            Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);

            Console.Write("CoOrds 2: ");
            Console.WriteLine("x = {0}, y = {1}", coords2.x, coords2.y);

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
    }
Ejemplo n.º 18
0
        private static void Structures()
        {
            // Initialize:
            CoOrds coords1 = new CoOrds();
            CoOrds coords2 = new CoOrds(10, 10);

            // Display results:
            Console.Write("CoOrds 1: ");
            Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);

            Console.Write("CoOrds 2: ");
            Console.WriteLine("x = {0}, y = {1}", coords2.x, coords2.y);

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.Read();
        }
Ejemplo n.º 19
0
        public static void execute()
        {
            char exec = '-';
            if (exec == '+') {
                Console.WriteLine("Exemple d'utilisation Struct:\r\n");

                Point c = new Point(10, 15); Console.WriteLine("Point: " + c); // Point est une struc de System.Drawing qui a un ToString correct
                CoOrds coords1 = new CoOrds(); Console.WriteLine("CoOrds 1: x = {0}, y = {1}", coords1.x, coords1.y);
                CoOrds coords2 = new CoOrds(10, 15); Console.WriteLine(coords2);

                Console.WriteLine("Avant appel de methode " + coords2);
                methode(coords2); // le param coOrds et de type VALEUR
                Console.WriteLine("Après appel de methode " + coords2);

                Console.WriteLine("\r\n");
            }
        }
        //[TestMethod]
        public bool CoOrdsParameterizedConstructorInitializesXandY()
        {
            const int x = 10;
            const int y = 15;

            // Declare a struct object without "new"
            CoOrds coords;

            coords.x = x;
            coords.y = y;

            var result = new CoOrds(x, y);

            return(result.x == coords.x && result.y == coords.y);
            //Assert.AreEqual(result.x, coords.x);
            //Assert.AreEqual(result.y, coords.y);
        }
Ejemplo n.º 21
0
    /* Destroy finished plane and spawn a new one */
    public void newPlane()
    {
        CoOrds coords_temp = new CoOrds();

        itr = 0;

        /* Destroy completed plane */
        GameObject[] completed = GameObject.FindGameObjectsWithTag("static_sphere");

        for (var i = 0; i < completed.Length; i++)
        {
            Destroy(completed[i]);
        }

        /* Spawn new plane's static points */
        for (int i = 0; i < coOrds_collection[order[plane]].Count; i++)
        {
            coords_temp = coOrds_collection[order[plane]] [i];
            Transform static_pt = Instantiate(static_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform);               // Make this gameObject the parent

            switch (coords_temp.plane)
            {
            case "front":
                static_pt.GetComponent <StaticSpot>().plane = "front";
                break;

            case "middle":
                static_pt.GetComponent <StaticSpot>().plane = "middle";
                break;

            case "back":
                static_pt.GetComponent <StaticSpot>().plane = "back";
                break;
            }

            static_pt.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);              // Spawn position relative to parent
        }

        /* Spawn new plane's intial trigger point */
        coords_temp = coOrds_collection[order[plane]] [itr];
        Transform trigger = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent

        trigger.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
        itr++;
    }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            CoOrds coords1 = new CoOrds();
            CoOrds coords2 = new CoOrds(10, 10);

            // Display results:
            Console.Write("CoOrds 1: ");
            Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);

            Console.Write("CoOrds 2: ");
            Console.WriteLine("x = {0}, y = {1}", coords2.x, coords2.y);

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

            return;
        }
Ejemplo n.º 23
0
    /* Shuffle a coordinate list. */
    public void shuffle(ref List <CoOrds> coOrds_collection)
    {
        /* Fisher Yates shuffle list to randomize spawn order */
        UnityEngine.Debug.Log("Shuffling hotspot spawn points!");

        CoOrds coords_temp = new CoOrds();
        int    random_placeholder;

        for (int i = 0; i < coOrds_collection.Count; i++)
        {
            random_placeholder = i + Random.Range(0, coOrds_collection.Count - i);

            /* Swap */
            coords_temp           = coOrds_collection [i];
            coOrds_collection [i] = coOrds_collection [random_placeholder];
            coOrds_collection [random_placeholder] = coords_temp;
        }
    }
Ejemplo n.º 24
0
        public GameObject(double height, double width, CoOrds сoordinatеs, string name)
        {
            this.height = height;
            this.width  = width;
            this.name   = name;

            Crds.LB.x = сoordinatеs.x;
            Crds.LB.y = сoordinatеs.y;

            Crds.RB.x = Crds.LB.x + width;
            Crds.RB.y = Crds.LB.y;

            Crds.RT.x = Crds.LB.x + width;
            Crds.RT.y = Crds.LB.y + height;

            Crds.LT.x = Crds.LB.x;
            Crds.LT.y = Crds.LB.y + height;
        }
Ejemplo n.º 25
0
        public static Tuple <CoOrds, CoOrds, bool> walk(int distance, List <CoOrds> stops, CoOrds stop, CoOrds EasterHQ, int dir, bool ebFound)
        {
            // Determines which direction to increment
            // Checks to see if we've been here before
            int steps = 0;

            while (steps < distance)
            {
                if (dir == 0)
                {
                    stop.y++;
                }
                else if (dir == 1)
                {
                    stop.x++;
                }
                else if (dir == 2)
                {
                    stop.y--;
                }
                else
                {
                    stop.x--;
                }

                if (ebFound == false)
                {
                    if (stops.Contains(stop))
                    {
                        ebFound  = true;
                        EasterHQ = stop;
                    }
                    else
                    {
                        stops.Add(stop);
                    }
                }
                steps++;
            }
            var returnTuple = Tuple.Create(stop, EasterHQ, ebFound);

            return(returnTuple);
        }
Ejemplo n.º 26
0
        public static void ExecuteExample()
        {
            //initialize
            CoOrds coords1 = new CoOrds();
            CoOrds coords2 = new CoOrds(10, 5);

            Console.WriteLine($"Coords1 -> X: {coords1.x} - Y: {coords1.y}");
            Console.WriteLine($"Coords2 -> X: {coords2.x} - Y: {coords2.y}");

            coords1   = coords2;
            coords2.x = 200;
            coords2.y = 100;

            Console.WriteLine($"Coords1 -> X: {coords1.x} - Y: {coords1.y}");
            Console.WriteLine($"Coords2 -> X: {coords2.x} - Y: {coords2.y}");

            // Coords1 -> X: 0 - Y: 0
            // Coords2 -> X: 10 - Y: 5
            // Coords1 -> X: 10 - Y: 5
            // Coords2 -> X: 200 - Y: 100
        }
Ejemplo n.º 27
0
        public void GetTileCoOrds(CoOrds refTile, int move)
        {
            int      X    = refTile.X;
            int      Y    = refTile.Y;
            Movement path = (Movement)Enum.Parse(typeof(Movement), move.ToString());

            switch (path)
            {
            case Movement.UP:
                Y += 2;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;

            case Movement.UP_RIGHT:
                X += 1;
                Y += 1;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;

            case Movement.UP_LEFT:
                X -= 1;
                Y += 1;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;

            case Movement.DOWN:
                Y -= 2;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;

            case Movement.DOWN_RIGHT:
                X += 1;
                Y -= 1;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;

            case Movement.DOWN_LEFT:
                X -= 1;
                Y -= 1;
                foreach (CoOrds e in tilePosition)
                {
                    if (e.X == X && e.Y == Y)
                    {
                        l_x = e.X;
                        l_y = e.Y;
                        CheckCoOrds(l_x, l_y, t_x, t_y);
                    }
                }
                break;
            }
        }
    private float radius; // set from main menu slider

    /* Use this for initialization */
    void Start()
    {
        // Position camera
        camera = GameObject.Find("MixedRealityCameraParent");
        camera.transform.position = new Vector3(0.0f, 0.0f, -2.75f);

        // Create unique out file
        fileName = fileName + System.DateTime.Now + ".txt";
        fileName = fileName.Replace("/", "-");
        fileName = fileName.Replace(":", ";");
        path     = Path.Combine(Application.persistentDataPath, fileName);
        //Test outfile
        //File.WriteAllText(@path, "trace");

        // Write task set up to results file
        // Error : R, 1, 3, 5
        // # Trials : 1, 2, 3
        config = GameObject.Find("TaskConfig").GetComponent <TaskConfig>();
        //UnityEngine.Debug.Log("pointing_error: " + config.pointing_error);
        //UnityEngine.Debug.Log("number_of_trials: " + config.number_of_trials);
        File.AppendAllText(@path, "Trials  : " + config.number_of_trials);
        File.AppendAllText(@path, "\r\n");
        File.AppendAllText(@path, "Error   : " + config.pointing_error);
        File.AppendAllText(@path, "\r\n");

        // convert # trials from string to int
        //TODO change to generic trials?
        switch (config.number_of_trials)
        {
        case "1":
            total_trials = 1;
            break;

        case "2":
            total_trials = 2;
            break;

        case "3":
            total_trials = 3;
            break;

        default:
            //
            break;
        }

        // set radius from main menu preset
        radius = config.sliderValueMainMenu_SphereCollectionSize;

        // move counter and sliders depending on how large the radius is
        counter_label  = GameObject.Find("counter label");
        slider_manager = GameObject.Find("Slider_Manager");

        if (radius >= 0.75)
        {
            counter_label.transform.position  = new Vector3(1.415f, 0.6f, 0f);
            slider_manager.transform.position = new Vector3(2.4f, 0.35f, 0f);

            CoOrds counter_1 = new CoOrds(0.71f + 0.6f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_1);
            CoOrds counter_2 = new CoOrds(0.81f + 0.6f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_2);
            CoOrds counter_3 = new CoOrds(0.91f + 0.6f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_3);
        }
        else if (radius >= 0.70f)
        {
            counter_label.transform.position  = new Vector3(1.265f, 0.6f, 0f);
            slider_manager.transform.position = new Vector3(2.25f, 0.35f, 0f);

            CoOrds counter_1 = new CoOrds(0.71f + 0.45f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_1);
            CoOrds counter_2 = new CoOrds(0.81f + 0.45f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_2);
            CoOrds counter_3 = new CoOrds(0.91f + 0.45f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_3);
        }
        else if (radius >= 0.65)
        {
            counter_label.transform.position  = new Vector3(1.115f, 0.6f, 0f);
            slider_manager.transform.position = new Vector3(2.1f, 0.35f, 0f);

            CoOrds counter_1 = new CoOrds(0.71f + 0.3f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_1);
            CoOrds counter_2 = new CoOrds(0.81f + 0.3f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_2);
            CoOrds counter_3 = new CoOrds(0.91f + 0.3f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_3);
        }
        else
        {
            CoOrds counter_1 = new CoOrds(0.71f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_1);
            CoOrds counter_2 = new CoOrds(0.81f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_2);
            CoOrds counter_3 = new CoOrds(0.91f, 0.5f, 0.0f, null);
            counter_collection.Add(counter_3);
        }

        /* Generate */
        initializeCoordinates(ref order, ref coOrds_collection, ref coOrds_collection_2);

        /* Call function once on startup to create initial hotspot */
        HotSpotTriggerInstantiate();
    }
    /* Spawn trigger points until 1 plane is completed */
    public void HotSpotTriggerInstantiate()
    {
        /* check if user has tapped first point */
        if (itr == 1)
        {
            UnityEngine.Debug.Log("Trial " + (trial + 1) + " timing start");
            // Begin timing
            stopwatch.Start();
        }

        CoOrds coords_temp = new CoOrds();

        /* Spawn trigger points */
        if (itr < coOrds_collection[order[0]].Count)                                                                                                       // hard set order[0], previously order[trial], to account for variable # trials
        {
            coords_temp = coOrds_collection[order[0]] [itr];                                                                                               // hard set order[0], previously order[trial], to account for variable # trials
            Transform trigger = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            trigger.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
            itr++;
        }

        /* Trial is completed */
        else
        {
            // Spawn trial counter
            trial++;
            UnityEngine.Debug.Log("Trial " + trial + " completed!");
            coords_temp = counter_collection[trial - 1];
            Instantiate(trial_counter, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity);

            // Stop timing
            System.TimeSpan ts = stopwatch.Elapsed;
            stopwatch.Stop();
            UnityEngine.Debug.Log("Time elapsed: " + ts);
            stopwatch.Reset();

            // Write time to file
            File.AppendAllText(@path, "Trial " + trial + " : ");
            File.AppendAllText(@path, ts.ToString());
            File.AppendAllText(@path, "\r\n");

            if (trial < total_trials)
            {
                UnityEngine.Debug.Log("Trial " + trial + " completed!");
                // reset
                itr = 0;

                // shuffle and spawn first trigger point for next trial
                int numberOfObjects = 18;
                int random_placeholder;

                for (int i = 0; i < numberOfObjects; i++)
                {
                    random_placeholder = i + Random.Range(0, numberOfObjects - i);

                    /* Swap */
                    coords_temp            = coOrds_collection_2[i];
                    coOrds_collection_2[i] = coOrds_collection_2[random_placeholder];
                    coOrds_collection_2[random_placeholder] = coords_temp;
                }

                coords_temp = coOrds_collection[order[0]][itr];                                                                                                // hard set order[0], previously order[trial], to account for variable # trials
                Transform trigger = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
                trigger.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
                itr++;
            }
            else
            {
                UnityEngine.Debug.Log("Finish");
                Transform finish = Instantiate(finish_label, new Vector3(0f, 0f, 0f), Quaternion.identity, this.transform); // Make this gameobject the parent
                finish.localPosition = new Vector3(0f, 0f, 0f);                                                             // Spawn position relative to parent
            }
        }
    }
Ejemplo n.º 30
0
    /* Shuffle coordinate list by plane and shuffle plane order */
    public void shuffle(ref List <CoOrds> coOrds_collection, ref List <CoOrds> coOrds_collection_1, ref List <CoOrds> coOrds_collection_2, ref List <CoOrds> coOrds_collection_3)
    {
        int i;
        int temp;
        int random_placeholder;

        int[]  order       = { 1, 2, 3 };
        CoOrds coords_temp = new CoOrds();

        /* Fisher Yates shuffle coordinate lists to randomize spawn order */
        //UnityEngine.Debug.Log ("Shuffling spawn points within planes...");

        /* z = 0 frame */
        for (i = 0; i < coOrds_collection_1.Count; i++)
        {
            random_placeholder = i + Random.Range(0, coOrds_collection_1.Count - i);

            /* Swap */
            coords_temp             = coOrds_collection_1 [i];
            coOrds_collection_1 [i] = coOrds_collection_1 [random_placeholder];
            coOrds_collection_1 [random_placeholder] = coords_temp;
        }

        /* z = 0.3 frame */
        for (i = 0; i < coOrds_collection_2.Count; i++)
        {
            random_placeholder = i + Random.Range(0, coOrds_collection_2.Count - i);

            /* Swap */
            coords_temp             = coOrds_collection_2 [i];
            coOrds_collection_2 [i] = coOrds_collection_2 [random_placeholder];
            coOrds_collection_2 [random_placeholder] = coords_temp;
        }

        /* z = 0.6 frame */
        for (i = 0; i < coOrds_collection_3.Count; i++)
        {
            random_placeholder = i + Random.Range(0, coOrds_collection_3.Count - i);

            /* Swap */
            coords_temp             = coOrds_collection_3 [i];
            coOrds_collection_3 [i] = coOrds_collection_3 [random_placeholder];
            coOrds_collection_3 [random_placeholder] = coords_temp;
        }

        /* Randomize the plane order */
        //UnityEngine.Debug.Log("Plane order before shuffle: " + order[0] + order[1] + order[2]);

        for (i = 0; i < 3; i++)
        {
            random_placeholder = i + Random.Range(0, 3 - i);

            /* Swap */
            temp     = order[i];
            order[i] = order[random_placeholder];
            order[random_placeholder] = temp;
        }

        //UnityEngine.Debug.Log("Plane order after shuffle: " + order[0] + order[1] + order[2]);

        /* Randomly add each shuffled plane into the coOrds_collection list */
        coOrds_collection.Clear();

        for (i = 0; i < 3; i++)
        {
            switch (order[i])
            {
            case 1:
                coOrds_collection.AddRange(coOrds_collection_1);
                break;

            case 2:
                coOrds_collection.AddRange(coOrds_collection_2);
                break;

            case 3:
                coOrds_collection.AddRange(coOrds_collection_3);
                break;
            }
        }
    }
Ejemplo n.º 31
0
    /* Spawn trigger points until 3 trials are completed */
    public void HotSpotTriggerInstantiate()
    {
        int    i;
        int    temp;
        int    random_placeholder;
        CoOrds coords_temp = new CoOrds();

        /* Check if user has tapped first point */
        if (itr == 1 && plane == 0)
        {
            // Start timers
            trial_stopwatch.Start();
            plane_stopwatch.Start();
        }
        else if (itr == 1)
        {
            // Start each plane timer when the plane's first trigger point is activated
            plane_stopwatch.Start();
        }

        /* Begin spawning */
        if (plane < 3 && itr != coOrds_collection[order[plane]].Count)
        {
            /* Spawn the trigger point */
            coords_temp = coOrds_collection[order[plane]] [itr];
            Transform trigger = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            trigger.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
            itr++;
        }
        /* Spawn new plane */
        else if (++plane < 3)
        {
            newPlane();

            // Stop plane timing
            plane_time = plane_stopwatch.Elapsed;
            plane_stopwatch.Stop();
            UnityEngine.Debug.Log("Plane " + plane + " : " + plane_time + " " + GameObject.Find("static_point(Clone)").GetComponent <StaticSpot>().plane);
            plane_stopwatch.Reset();

            // Write plane time to file
            File.AppendAllText(@path, "Plane " + plane + " : ");
            File.AppendAllText(@path, plane_time.ToString() + " " + GameObject.Find("static_point(Clone)").GetComponent <StaticSpot>().plane);
            File.AppendAllText(@path, "\r\n");
        }
        /* Start new trial and spawn counter */
        else if (trial < 3)
        {
            // Stop plane timing
            System.TimeSpan plane_time = plane_stopwatch.Elapsed;
            plane_stopwatch.Stop();
            UnityEngine.Debug.Log("Plane " + plane + " : " + plane_time + " " + GameObject.Find("static_point(Clone)").GetComponent <StaticSpot>().plane);
            plane_stopwatch.Reset();

            // Write plane time to file
            File.AppendAllText(@path, "Plane " + plane + " : ");
            File.AppendAllText(@path, plane_time.ToString() + " " + GameObject.Find("static_point(Clone)").GetComponent <StaticSpot>().plane);
            File.AppendAllText(@path, "\r\n");

            // Spawn trial counter
            trial++;
            UnityEngine.Debug.Log("Trial " + trial + " completed!");
            coords_temp = counter_collection [trial - 1];
            Instantiate(trial_counter, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity);

            // Stop trial timing
            System.TimeSpan trial_time = trial_stopwatch.Elapsed;
            trial_stopwatch.Stop();
            UnityEngine.Debug.Log("Trial " + trial + " : " + trial_time);
            trial_stopwatch.Reset();

            // Write trial time to file
            File.AppendAllText(@path, "Trial " + trial + " : ");
            File.AppendAllText(@path, trial_time.ToString());
            File.AppendAllText(@path, "\r\n");

            // Do not time after third trial
            if (trial < 3)
            {
                // Shuffle plane order before new trial
                for (i = 0; i < 3; i++)
                {
                    random_placeholder = i + Random.Range(0, 3 - i);

                    /* Swap */
                    temp     = order[i];
                    order[i] = order[random_placeholder];
                    order[random_placeholder] = temp;
                }

                plane = 0;
                newPlane();
            }
            else
            {
                UnityEngine.Debug.Log("Finish");
                Transform finish = Instantiate(finish_label, new Vector3(0f, 0f, 0f), Quaternion.identity, this.transform); // Make this gameobject the parent
                finish.localPosition = new Vector3(0f, 0f, 0f);                                                             // Spawn position relative to parent
            }
        }
    }
Ejemplo n.º 32
0
        /// <summary>
        /// Find the coordinates of 8 neighbours based on coordinates of one cell
        /// </summary>
        /// <param name="currentCoOrds">CoOrdinates of cell of which you wish to find the neighbours</param>
        /// <returns>Collection of 8 CoOrds objects</returns>
        private List<CoOrds> GetNeighbouringCoOrds(CoOrds currentCoOrds)
        {
            var neighbouringCoOrds = new List<CoOrds>();

            var neighbourY = currentCoOrds.Y - 1;  // row above
            while (neighbourY <= currentCoOrds.Y + 1)
            {
                var neighbourX = currentCoOrds.X - 1;  // column to the left
                while (neighbourX <= currentCoOrds.X + 1)
                {
                    var neighbourCoOrds = new CoOrds(neighbourX, neighbourY);
                    if (!neighbourCoOrds.Equals(currentCoOrds)) // don't add the original coords to the list of neighbours
                    {
                        neighbouringCoOrds.Add(neighbourCoOrds);
                    }
                    neighbourX++;
                }
                neighbourY++;
            }

            return neighbouringCoOrds;
        }
Ejemplo n.º 33
0
    /* Populate point collection and counter collection coordinate lists.
     * Parameters are global list variables referencing the coordinate collections.
     * At the start it is empty and after this function finishes it is filled
     * with all the trigger point coordinates in a randomized order and trial.
     * counter coordinates. */
    public void initializeCoordinates(ref List <CoOrds> coOrds_collection, ref List <CoOrds> counter_collection)
    {
        /* Create all the data points and add them to the list */
        /* z = 0 frame				 (x, y, z) */
        CoOrds coords_1 = new CoOrds(0, 0, 0, "front");

        coOrds_collection.Add(coords_1);
        CoOrds coords_2 = new CoOrds(0.3f, 0, 0, "front");

        coOrds_collection.Add(coords_2);
        CoOrds coords_3 = new CoOrds(0.6f, 0, 0, "front");

        coOrds_collection.Add(coords_3);
        CoOrds coords_4 = new CoOrds(0, 0.3f, 0, "front");

        coOrds_collection.Add(coords_4);
        CoOrds coords_5 = new CoOrds(0.3f, 0.3f, 0, "front");

        coOrds_collection.Add(coords_5);
        CoOrds coords_6 = new CoOrds(0.6f, 0.3f, 0, "front");

        coOrds_collection.Add(coords_6);
        CoOrds coords_7 = new CoOrds(0, 0.6f, 0, "front");

        coOrds_collection.Add(coords_7);
        CoOrds coords_8 = new CoOrds(0.3f, 0.6f, 0, "front");

        coOrds_collection.Add(coords_8);
        CoOrds coords_9 = new CoOrds(0.6f, 0.6f, 0, "front");

        coOrds_collection.Add(coords_9);

        /* z = 0.3 frame			  (x, y, z) */
        CoOrds coords_10 = new CoOrds(0, 0, 0.3f, "middle");

        coOrds_collection.Add(coords_10);
        CoOrds coords_11 = new CoOrds(0.3f, 0, 0.3f, "middle");

        coOrds_collection.Add(coords_11);
        CoOrds coords_12 = new CoOrds(0.6f, 0, 0.3f, "middle");

        coOrds_collection.Add(coords_12);
        CoOrds coords_13 = new CoOrds(0, 0.3f, 0.3f, "middle");

        coOrds_collection.Add(coords_13);
        CoOrds coords_14 = new CoOrds(0.3f, 0.3f, 0.3f, "middle");

        coOrds_collection.Add(coords_14);
        CoOrds coords_15 = new CoOrds(0.6f, 0.3f, 0.3f, "middle");

        coOrds_collection.Add(coords_15);
        CoOrds coords_16 = new CoOrds(0, 0.6f, 0.3f, "middle");

        coOrds_collection.Add(coords_16);
        CoOrds coords_17 = new CoOrds(0.3f, 0.6f, 0.3f, "middle");

        coOrds_collection.Add(coords_17);
        CoOrds coords_18 = new CoOrds(0.6f, 0.6f, 0.3f, "middle");

        coOrds_collection.Add(coords_18);

        /* z = 0.6 frame			  (x, y, z) */
        CoOrds coords_19 = new CoOrds(0, 0, 0.6f, "back");

        coOrds_collection.Add(coords_19);
        CoOrds coords_20 = new CoOrds(0.3f, 0, 0.6f, "back");

        coOrds_collection.Add(coords_20);
        CoOrds coords_21 = new CoOrds(0.6f, 0, 0.6f, "back");

        coOrds_collection.Add(coords_21);
        CoOrds coords_22 = new CoOrds(0, 0.3f, 0.6f, "back");

        coOrds_collection.Add(coords_22);
        CoOrds coords_23 = new CoOrds(0.3f, 0.3f, 0.6f, "back");

        coOrds_collection.Add(coords_23);
        CoOrds coords_24 = new CoOrds(0.6f, 0.3f, 0.6f, "back");

        coOrds_collection.Add(coords_24);
        CoOrds coords_25 = new CoOrds(0, 0.6f, 0.6f, "back");

        coOrds_collection.Add(coords_25);
        CoOrds coords_26 = new CoOrds(0.3f, 0.6f, 0.6f, "back");

        coOrds_collection.Add(coords_26);
        CoOrds coords_27 = new CoOrds(0.6f, 0.6f, 0.6f, "back");

        coOrds_collection.Add(coords_27);

        /* Shuffle list to randomize spawn order */
        shuffle(ref coOrds_collection);

        /* Trial counters */
        CoOrds counter_1 = new CoOrds(-0.43f, 0.57f, 0.3f, null);

        counter_collection.Add(counter_1);
        CoOrds counter_2 = new CoOrds(-0.37f, 0.57f, 0.3f, null);

        counter_collection.Add(counter_2);
        CoOrds counter_3 = new CoOrds(-0.31f, 0.57f, 0.3f, null);

        counter_collection.Add(counter_3);
    }
Ejemplo n.º 34
0
    /* This function is called from Hotspot.cs after Start () */
    public void HotSpotTriggerInstantiate()
    {
        /* check if user has tapped first point */
        if (itr == 1)
        {
            // Begin timing
            stopwatch.Start();
        }

        CoOrds coords_temp = new CoOrds();

        /* Begin spawning */
        if (itr < coOrds_collection.Count)
        {
            UnityEngine.Debug.Log("coOrds_collection count: " + coOrds_collection.Count + " itr: " + itr);

            /* Copy the next coordinate in the list to the temp variable */
            coords_temp = coOrds_collection [itr];
            itr++;

            /* Spawn the point */
            Transform local_trigger_point = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform);               // Make this gameObject the parent

            switch (coords_temp.plane)
            {
            case "front":
                local_trigger_point.tag = "front";
                break;

            case "middle":
                local_trigger_point.tag = "middle";
                break;

            case "back":
                local_trigger_point.tag = "back";
                break;
            }

            local_trigger_point.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);              // Spawn position relative to parent

            /* UnityEngine.Debugging */
            if (itr == coOrds_collection.Count)
            {
                UnityEngine.Debug.Log("Entire Coords_Collection spawned!");
                UnityEngine.Debug.Log("coOrds_collection count: " + coOrds_collection.Count + " itr: " + itr);
            }
        }
        /* Start new trial and update counter */
        else
        {
            UnityEngine.Debug.Log("Starting a new trial!");

            /* Copy counter location coordinates */
            coords_temp = counter_collection [trial];
            trial++;

            // Stop timing
            System.TimeSpan ts = stopwatch.Elapsed;
            stopwatch.Stop();
            UnityEngine.Debug.Log("Time elapsed: " + ts);
            stopwatch.Reset();

            // Write time to file
            File.AppendAllText(@path, "Trial " + trial + " : ");
            File.AppendAllText(@path, ts.ToString());
            File.AppendAllText(@path, "\r\n");

            /* Spawn counter */
            Transform local_trial_counter = Instantiate(trial_counter, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            local_trial_counter.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent

            UnityEngine.Debug.Log("Trial " + trial + " completed!");

            if (trial < 3)
            {
                reset();
            }
        }

        return;
    }
Ejemplo n.º 35
0
    /* Generate circular arrays of static points */
    public void initializeCoordinates(ref int[] order, ref List <List <CoOrds> > coOrds_collection, ref List <CoOrds> coOrds_collection_1, ref List <CoOrds> coOrds_collection_2, ref List <CoOrds> coOrds_collection_3)
    {
        int    i;
        int    temp;
        CoOrds temp_vector;
        int    random_placeholder;
        int    numberOfObjects = 18;

        /* z = 0 frame */
        for (i = 0; i < numberOfObjects; i++)
        {
            float  angle = i * Mathf.PI * 2 / numberOfObjects;
            CoOrds pos   = new CoOrds(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 0, "back");
            coOrds_collection_1.Add(pos);
        }

        /* Shuffle */
        for (i = 0; i < numberOfObjects; i++)
        {
            random_placeholder = i + Random.Range(0, numberOfObjects - i);

            /* Swap */
            temp_vector            = coOrds_collection_1[i];
            coOrds_collection_1[i] = coOrds_collection_1[random_placeholder];
            coOrds_collection_1[random_placeholder] = temp_vector;
        }

        /* z = 0.3 frame */
        for (i = 0; i < numberOfObjects; i++)
        {
            float  angle = i * Mathf.PI * 2 / numberOfObjects;
            CoOrds pos   = new CoOrds(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 0.3f, "middle");
            coOrds_collection_2.Add(pos);
        }

        /* Shuffle */
        for (i = 0; i < numberOfObjects; i++)
        {
            random_placeholder = i + Random.Range(0, numberOfObjects - i);

            /* Swap */
            temp_vector            = coOrds_collection_2[i];
            coOrds_collection_2[i] = coOrds_collection_2[random_placeholder];
            coOrds_collection_2[random_placeholder] = temp_vector;
        }

        /* z = 0.6 frame */
        for (i = 0; i < numberOfObjects; i++)
        {
            float  angle = i * Mathf.PI * 2 / numberOfObjects;
            CoOrds pos   = new CoOrds(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, 0.6f, "front");
            coOrds_collection_3.Add(pos);
        }

        /* Shuffle */
        for (i = 0; i < numberOfObjects; i++)
        {
            random_placeholder = i + Random.Range(0, numberOfObjects - i);

            /* Swap */
            temp_vector            = coOrds_collection_3[i];
            coOrds_collection_3[i] = coOrds_collection_3[random_placeholder];
            coOrds_collection_3[random_placeholder] = temp_vector;
        }

        /* Add planes to entire collection */
        coOrds_collection.Add(coOrds_collection_1);
        coOrds_collection.Add(coOrds_collection_2);
        coOrds_collection.Add(coOrds_collection_3);

        /* Shuffle plane order */
        //UnityEngine.Debug.Log("Plane order before shuffle: " + order[0] + order[1] + order[2]);

        for (i = 0; i < 3; i++)
        {
            random_placeholder = i + Random.Range(0, 3 - i);

            /* Swap */
            temp     = order[i];
            order[i] = order[random_placeholder];
            order[random_placeholder] = temp;
        }

        //UnityEngine.Debug.Log("Plane order after shuffle: " + order[0] + order[1] + order[2]);

        /* Trial counters */

        /*
         *      CoOrds counter_1 = new CoOrds (0.71f, 0.5f, 0.0f, null);
         *      counter_collection.Add (counter_1);
         *      CoOrds counter_2 = new CoOrds (0.81f, 0.5f, 0.0f, null);
         *      counter_collection.Add (counter_2);
         *      CoOrds counter_3 = new CoOrds (0.91f, 0.5f, 0.0f, null);
         *      counter_collection.Add (counter_3);
         */

        /* Spawn initial static points */
        for (i = 0; i < numberOfObjects; i++)
        {
            temp_vector = coOrds_collection[order[trial]] [i];
            Transform static_pt = Instantiate(static_point, new Vector3(temp_vector.x, temp_vector.y, temp_vector.z), Quaternion.identity, this.transform);              // Make this gameObject the parent

            switch (temp_vector.plane)
            {
            case "front":
                static_pt.GetComponent <StaticSpot>().plane = "front";
                break;

            case "middle":
                static_pt.GetComponent <StaticSpot>().plane = "middle";
                break;

            case "back":
                static_pt.GetComponent <StaticSpot>().plane = "back";
                break;
            }
        }
    }
Ejemplo n.º 36
0
    /* This function is called from Hotspot.cs after Start ().
     * Instead of spawning all the points at random like OEBL-Cube,
     * the three frontal planes are randomized and then points within
     * the current plane are spawned at random until the plane is filled. Then
     * the next plane's points are filled until all three planes are complete. */
    public void HotSpotTriggerInstantiate()
    {
        /* check if user has tapped first point */
        if (itr == 1)
        {
            // Begin trial and plane 1 timing
            UnityEngine.Debug.Log("Start a trial and plane 1 timing.");
            trial_stopwatch.Start();
            plane_stopwatch.Start();
        }
        else if (itr == 10)
        {
            // Begin plane 2 timing
            UnityEngine.Debug.Log("Start plane 2 timing.");
            plane_stopwatch.Start();
        }
        else if (itr == 19)
        {
            // Begin plane 3 timing
            UnityEngine.Debug.Log("Start plane 3 timing.");
            plane_stopwatch.Start();
        }

        CoOrds coords_temp = new CoOrds();

        /* Begin spawning */
        if (itr < coOrds_collection.Count)
        {
            //UnityEngine.Debug.Log ("coOrds_collection count: " + coOrds_collection.Count + " itr: " + itr);

            /* Copy the next coordinate in the list to the temp variable */
            coords_temp = coOrds_collection [itr];

            /* Spawn the point */
            Transform local_trigger_point = Instantiate(trigger_point, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            local_trigger_point.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent

            switch (coords_temp.plane)
            {
            case "front":
                local_trigger_point.tag = "front";
                break;

            case "middle":
                local_trigger_point.tag = "middle";
                break;

            case "back":
                local_trigger_point.tag = "back";
                break;
            }

            // Plane timing
            if (itr == 9)
            {
                plane_1_time = plane_stopwatch.Elapsed;
                plane_stopwatch.Reset();
                coords_temp = coOrds_collection [itr - 1];                 // Copy the previous coordinate in the list to determine last plane
                UnityEngine.Debug.Log("Plane 1: " + coords_temp.plane + " " + plane_1_time);

                // Write time to file
                File.AppendAllText(@path, "Plane 1" + " : ");
                File.AppendAllText(@path, plane_1_time.ToString() + " " + coords_temp.plane);
                File.AppendAllText(@path, "\r\n");
            }
            else if (itr == 18)
            {
                plane_2_time = plane_stopwatch.Elapsed;
                plane_stopwatch.Reset();
                coords_temp = coOrds_collection [itr - 1];                 // Copy the previous coordinate in the list to determine last plane
                UnityEngine.Debug.Log("Plane 2: " + coords_temp.plane + " " + plane_2_time);

                // Write time to file
                File.AppendAllText(@path, "Plane 2" + " : ");
                File.AppendAllText(@path, plane_2_time.ToString() + " " + coords_temp.plane);
                File.AppendAllText(@path, "\r\n");
            }

            itr++;
        }
        //TODO add details to results file
        /* Start new trial and update counter */
        else
        {
            //UnityEngine.Debug.Log( "Starting a new trial!" );

            trial++;

            // Plane and trial timing
            trial_time = trial_stopwatch.Elapsed;
            trial_stopwatch.Reset();
            plane_3_time = plane_stopwatch.Elapsed;
            plane_stopwatch.Reset();
            coords_temp = coOrds_collection [itr - 1];             // Copy the previous coordinate in the list to determine last plane
            UnityEngine.Debug.Log("Plane 3: " + coords_temp.plane + " " + plane_3_time);
            UnityEngine.Debug.Log("Trial " + trial + ": " + trial_time);
            trial_stopwatch.Reset();

            // Write plane time to file
            File.AppendAllText(@path, "Plane 3" + " : ");
            File.AppendAllText(@path, plane_3_time.ToString() + " " + coords_temp.plane);
            File.AppendAllText(@path, "\r\n");

            // Write trial time to file
            File.AppendAllText(@path, "Trial " + trial + " : ");
            File.AppendAllText(@path, trial_time.ToString());
            File.AppendAllText(@path, "\r\n");

            /* Copy counter location coordinates */
            coords_temp = counter_collection [trial - 1];

            /* Spawn counter */
            Transform local_trial_counter = Instantiate(trial_counter, new Vector3(coords_temp.x, coords_temp.y, coords_temp.z), Quaternion.identity, this.transform); // Make this gameObject the parent
            local_trial_counter.localPosition = new Vector3(coords_temp.x, coords_temp.y, coords_temp.z);                                                              // Spawn position relative to parent
            UnityEngine.Debug.Log("Trial " + trial + " completed!");

            if (trial < total_trials)
            {
                reset();
            }
            else
            {
                UnityEngine.Debug.Log("All trials completed!");
            }
        }

        return;
    }