Example #1
0
    //PLAYER INPUT - KEYBOARD SHORTCUTS
    void Update()
    {
        if (keyboardShortcutsEnabled)   // if inputFields are not active
        {
            //Return to start position
            if (Input.GetKeyDown(KeyCode.Alpha0))
            {
                transform.position = startPosition;
                currentRotation    = startRotation;

                //ADD WAIT until you can move again
            }

            //TODO:VALIDEATE SELECTION (joystick)

            //END SESSION / RETURN TO MENU
            //if (Input.GetKeyDown(KeyCode.R))
            //{
            //    gameManager.GotoMenu();
            //}

            ////Restart session
            //if (Input.GetKeyDown(KeyCode.F))
            //{
            //    gameManager.PauseGame();
            //}

            //QUIT APPLICATION
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                //if (gameManager.sessionStarted)
                //    saveSessionData.stopSavingData();
                Application.Quit();
            }

            //Backwards force
            if (Input.GetKeyDown(KeyCode.I) && backStepForce > 1)
            {
                backStepForce -= .25f;
            }

            if (Input.GetKeyDown(KeyCode.O) && backStepForce < 5)
            {
                backStepForce += .25f;
            }


            //Location shortcuts - temporary for debugging
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                transform.position = new Vector3(0, 1, 0);
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                transform.position = new Vector3(0, 1, 245);
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                transform.position = new Vector3(245, 1, 245);
            }
            if (Input.GetKeyDown(KeyCode.Alpha4))
            {
                transform.position = new Vector3(245, 1, 105);
            }
            if (Input.GetKeyDown(KeyCode.Alpha5))
            {
                transform.position = new Vector3(385, 1, 105);
            }
            if (Input.GetKeyDown(KeyCode.Alpha6))
            {
                transform.position = new Vector3(385, 1, -140);
            }
            if (Input.GetKeyDown(KeyCode.Alpha7))
            {
                transform.position = new Vector3(140, 1, -140);
            }
            if (Input.GetKeyDown(KeyCode.Alpha8))
            {
                transform.position = new Vector3(140, 1, 0);
            }

            //Hide Canvas
            if (Input.GetKeyDown(KeyCode.M))
            {
                uiManager.debugCanvas.enabled = !uiManager.debugCanvas.enabled;
            }

            //Button active
            if (Input.GetKeyDown(KeyCode.B))
            {
                checkpointManager.ClickCheckpointBtn();
            }

            //Record route
            if (Input.GetKeyDown(KeyCode.C))
            {
                gameManager.RecordRoute();
            }

            //Take screenshot
            if (Input.GetKeyDown(KeyCode.P))
            {
                screenshotManager.TakeScreenshot();
            }

            //VALIDATION
            if (Input.GetKeyDown(KeyCode.Space))
            {
                gameManager.CheckValidation();
            }

            //NEW ATTEMPT
            if (Input.GetKeyDown(KeyCode.X))
            {
                //Debug.Log("Session status changed (Started or Ended)");
                //Debug.Log("session Route cleared");
                gameManager.NewAttempt(true);
            }

            //START SESSION
            if (Input.GetKeyDown(KeyCode.S))
            {
                if (!gameManager.sessionStarted)
                {
                    gameManager.StartSession();
                }
                else
                {
                    gameManager.EndSession(true);
                }
            }
        }
    }