public void TakeScreenshotsAtIntersection(int x, int z) { // 1. for each element in validCood - for each element in validDir - call goto and take screenshot for each validDir //foreach (string coord in intersectionManager.validCoord){ //} //int i = 1; //int j = 1; string coord = x + routeManager.xyCoordSeparator + z; string dir; string screenshotName; //ALL //screenshotName = coord + screenshotDir + ".png"; //intersectionManager.GotoCoord(coord, screenshotDir); //player.transform.Translate(xOffset, 0, zOffset); //ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //Debug.Log("Screenshot " + screenshotName); // North //dir = "N"; //screenshotName = coord + dir + ".png"; //intersectionManager.GotoCoord(coord, dir); //player.transform.Translate(0, 0, -5); //ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //Debug.Log("Screenshot " + screenshotName); // South //dir = "S"; //screenshotName = coord + dir + ".png"; //intersectionManager.GotoCoord(coord, dir); //player.transform.Translate(0, 0, 5); //ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //Debug.Log("Screenshot " + screenshotName); //// East //dir = "E"; //screenshotName = coord + dir + ".png"; //intersectionManager.GotoCoord(coord, dir); //player.transform.Translate(-5, 0, 0); //ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //// West //dir = "W"; screenshotName = coord + screenshotDir + ".png"; intersectionManager.GotoCoord(coord, screenshotDir); player.transform.Translate(0, 0, screenshotOffset); ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //List<string> directions = new List<string> { "NW", "NE", "SW", "SE" }; //foreach (string direction in directions) //{ // screenshotName = coord + direction + ".png"; // intersectionManager.GotoCoord(coord, direction); // ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(gameManager.screenshotPath, screenshotName)); //} }
private void returnToWhere() { if (lastCheckpointCollected == 0) // no checkpoint has been collected return to start { Debug.Log("Return to start"); uiManager.OpenDialogBox("(2) Incorrect - retour au départ"); intersectionManager.GotoCoord(gameManager.sessionData.routeStart.ElementAt(0), gameManager.sessionData.routeStart.ElementAt(1)); //Place player at start of route uiManager.routeValidationText.text = "Incorrect - return to start"; } else // return to prebious checkpoint { Debug.Log("Return to previous checkpoint: " + lastCheckpointCollected); // go to the previous checkpoint //Display information UI // uiManager.OpenDialogBox("(3) Incorrect - retour au dernier checkpoint.\n" + checkpointsInstructionsS0.ElementAt(lastCheckpointCollected - 1)); //gameManager.freezePlayer = true; if (gameManager.sessionData.selectedRoute == 0) { uiManager.dialogBoxCheckpoint.GetComponent <CheckpointDialogBox>().instructionsText.text = "(3) Incorrect - retour au dernier checkpoint.\n" + checkpointsInstructionsS0.ElementAt(lastCheckpointCollected - 1); //send the checkpoitn text to the dialog box } else { uiManager.dialogBoxCheckpoint.GetComponent <CheckpointDialogBox>().instructionsText.text = "(3) Incorrect - retour au dernier checkpoint.\n" + checkpointsInstructionsS6.ElementAt(lastCheckpointCollected - 1); //send the checkpoitn text to the dialog box } uiManager.dialogBoxCheckpoint.gameObject.GetComponent <CheckpointDialogBox>().firstDialog = false; uiManager.dialogBoxCheckpoint.gameObject.SetActive(true); uiManager.dialogBoxCheckpoint.GetComponent <CheckpointDialogBox>().dialogBoxBtn.Select(); uiManager.dialogBoxCheckpoint.GetComponent <CheckpointDialogBox>().dialogBoxBtn.OnSelect(null); List <string> previousCheckpointCoord = routeManager.SplitCoordinates(allCheckpoints[lastCheckpointCollected - 1]); intersectionManager.GotoCoord(previousCheckpointCoord[0], previousCheckpointCoord[1]); Debug.Log("Goto called"); //gameManager.freezePlayer = true; uiManager.routeValidationText.text = "Incorrect - return to last checkpoint"; gameManager.freezePlayer = false; } }
public void ResetRoute() { Debug.Log("Inside GameManager.ResetRoute"); //Reset variables //uiManager.validationCheck = false; playerController.playerHasMoved = false; attemptCount++; attemptTime = Time.time; attemptDistance = 0; playerController.lastPosition = playerController.startPosition; intersectionManager.sessionRoute.Clear(); intersectionManager.sessionRouteDir.Clear(); //Move player back to start route intersectionManager.GotoCoord(sessionData.routeStart.ElementAt(0), sessionData.routeStart.ElementAt(1)); //player.transform.eulerAngles = new Vector3(0, playerController.currentRotation.y, 0); intersectionManager.lastCardinalDirection = ""; //playerController.playerRb.WakeUp(); //TEST to trigger onTriggerExit before resettings lastIntersection(); overideOnIntersectionExit = true; //used to manuall set the lastIntersection information when reseeting the route playerController.lastIntersection = playerController.startCoord; Debug.Log("Last intersection reset to: " + String.Join(",", playerController.lastIntersection)); InitialiseValidationInfo(); }
public void InitialisePlayer() { intersectionManager.GotoCoord(gameManager.sessionData.routeStart.ElementAt(0), gameManager.sessionData.routeStart.ElementAt(1)); //Place player at start of route //Record start position and rotation startPosition = transform.position; startRotation = currentRotation; //curentRottion is set in GotoCoord transform.eulerAngles = startRotation; //Set player to current rotation lastPosition = startPosition; //used to calculate distance travelled //lastCoord = (transform.position.x / gameManager.blockSize).ToString("F2"); startCoord = new float[] { (transform.position.x / gameManager.blockSize), (transform.position.z / gameManager.blockSize) }; //lastIntersection = startCoord; //restore insted of below lastIntersection = new float[] { (float)System.Math.Round(startCoord[0], 1), (float)System.Math.Round(startCoord[1], 1) }; //temporay - only used to simplify UI display }
// UI - GOTO BUTTON HANDLER void GotoBtnHandler() { Debug.Log("Inside button handler"); UpdateCoordinates(); intersectionManager.GotoCoord(inputCoord, inputDir); }