Esempio n. 1
0
    // ------------------------------------------------------------------------------------------------------ //
    // ------------------------- F I L E  &  D A T A  M A N A G E M E N T ----------------------------------- //
    // ------------------------------------------------------------------------------------------------------ //
    void Update()
    {
        if (terrainManager.startTimer)
        {
            // The Current Block
            block = PlayerPrefs.GetInt("numberOfBlocks").ToString();

            // Gets variables regarding difficulty
            difficulty = terrainManager.getCurrentDifficultyLevel().ToString();
            timer      = terrainManager.getTimer().ToString();

            // Gets the current X,Y,Z coordinates where the car is driving
            currentXPos = carbehaviour.transform.position.x.ToString();
            currentYPos = carbehaviour.transform.position.y.ToString();
            currentZPos = carbehaviour.transform.position.z.ToString();

            // Variables for points and passing cars correctly
            points = carbehaviour.getPoints().ToString();
            currentlyPassingCar = carbehaviour.getCurrentlyPassingCar().ToString();
            currentlyPassingRB  = carbehaviour.getCurrentlyPassingRB().ToString();

            // Variables for when car is crashing into another car
            currentlyCrashing = carbehaviour.getCurrentlyCrashingCar().ToString();
            crashedCarX       = carbehaviour.getCrashedX().ToString();
            crashedCarY       = carbehaviour.getCrashedY().ToString();
            crashedCarZ       = carbehaviour.getCrashedZ().ToString();
            totalCrashedCar   = carbehaviour.getTimesCrashedCar().ToString();

            // Variables for when car is crashing into a RoadBlock
            currentlyCrashingRB = carbehaviour.getCurrentlyCrashingRB().ToString();
            crashedRBX          = carbehaviour.getCrashedRBX().ToString();
            crashedRBY          = carbehaviour.getCrashedRBY().ToString();
            crashedRBZ          = carbehaviour.getCrashedRBZ().ToString();
            timesCrashedRB      = carbehaviour.getTimesCrashedRB().ToString();

            // Checks if the left/right keys are being pressed at that time
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                leftArrowPressed = "1";
            }
            if (Input.GetKeyUp(KeyCode.LeftArrow))
            {
                leftArrowPressed = "0";
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                rightArrowPressed = "1";
            }
            if (Input.GetKeyUp(KeyCode.RightArrow))
            {
                rightArrowPressed = "0";
            }

            //Debug.Log("getCurrentlyPassingRB: " + currentlyPassingRB);

            saveCarSpawnedDetails("0", "0", "0", "0", "0");
        }
    }