IEnumerator CheckPlayerLocation() { int previousLocation = 0; int consecutiveCounter = 0; while (true) { int playerLocation = gpsChecker.GetClosestBuilding(); if (playerLocation == previousLocation) { consecutiveCounter += 1; } else { consecutiveCounter = 0; } previousLocation = playerLocation; //switch (playerLocation) //{ // case (int) Buildings.Humboldt: // // Load Humboldt scene if GPS Location is consecutively Humboldt for long enough // if ((!(building == Buildings.Humboldt)) && consecutiveCounter > 3) // { // print(building); // LoadByIndex(2); // } // break; // case (int) Buildings.Kirchhoff: // // Load Kirchhoff scene if GPS Location is consecutively Humboldt for long enough // if ((!(building == Buildings.Kirchhoff)) && consecutiveCounter > 3) // { // print(building); // LoadByIndex(3); // } // break; // case (int)Buildings.Helmholtz: // // Load Helmholtz scene if GPS Location is consecutively Humboldt for long enough // if ((!(building == Buildings.Helmholtz)) && consecutiveCounter > 3) // { // print(building); // LoadByIndex(4); // } // break; // case (int) Buildings.Zuse: // // Load Zuse scene if GPS Location is consecutively Humboldt for long enough // if ((!(building == Buildings.Zuse)) && consecutiveCounter > 3) // { // print(building); // LoadByIndex(5); // } // break; // case 6: // // Load Test Location // break; // case 0: // // stay in current scene (error in GPS or location not found) // break; //} yield return(new WaitForSeconds(CheckLocationInterval)); } }