private void Start()
    {
        ScoreNameToFile DataHandler = new ScoreNameToFile();

        email.text = DataHandler.GetUserName();
        score.text = DataHandler.GetScore();
        date.text  = DateTime.Now.ToString("MM/dd/yyyy h:mm:ss tt");
    }
Exemple #2
0
    void Update()
    {
        //added to correct random loss of 200 points of level 3 and level 4
        if (levelTime > 118)
        {
            if (SceneName == "Level 3" || SceneName == "Level 4")
            {
                int ReceivedScore;
                int.TryParse(DataRecorder.GetScore(), out ReceivedScore);
                score          = ReceivedScore;
                scoreText.text = "Score: " + score.ToString();
            }
        }

        ComputeVelocity();

        // Decrease immunity timer when damaged
        if (timeCounter > 0 && damagedRecently == true)
        {
            timeCounter -= Time.deltaTime;
        }
        else if (timeCounter <= 0)
        {
            damagedRecently = false;
            timeCounter     = immunityTime;
        }

        if (currentHealth > maxHealth)
        {
            currentHealth = maxHealth;
        }
        if (currentHealth <= 0)
        {
            Die();
        }

        // When level time runs out, restart level
        if (levelTime > 0)
        {
            levelTime     -= Time.deltaTime;
            timerText.text = "Time: " + Mathf.RoundToInt(levelTime).ToString();
        }
        else
        {
            Die();
        }

        /*
         * // If player falls off map, restart level
         * if(transform.position.y < -15)
         * {
         *  Die();
         * }
         */
    }
Exemple #3
0
    void Start()
    {
        // added for score tracking
        DataRecorder = new ScoreNameToFile();

        // Start the game with max health.
        currentHealth = maxHealth;

        // Get information for double jump.
        CurrentScene = SceneManager.GetActiveScene();
        SceneName    = CurrentScene.name;

        //Setting scoreboard
        //adjusted by to set score on new Scene

        //added to fix bug that always adds 200 points to score when you die on level 3 and 4
        //if (SceneName == "Level 3" || SceneName == "Level 4")
        // {
        //    score = score - 200;
        //   Debug.Log("Ran Scorefix");
        // }

        if (SceneName == "Level 1")
        {
            score = 0;
            Debug.Log("Set score property to 0");
        }
        else
        {
            int ReceivedScore;
            int.TryParse(DataRecorder.GetScore(), out ReceivedScore);
            score = ReceivedScore;


            Debug.Log("Ran set property with no level 1 ReceivedScore is" + ReceivedScore.ToString());
            Debug.Log("score property is :" + score.ToString());
        }
        Debug.Log("Score sent to screen is " + score.ToString());
        scoreText.text = "Score: " + score.ToString();
        Debug.Log("Start method is run");
    }
    IEnumerator Upload()
    {
        List <IMultipartFormSection> formData = new List <IMultipartFormSection>();

        formData.Add(new MultipartFormDataSection("[email protected]&newHighscore=1100"));

        WWWForm form = new WWWForm();


        ScoreNameToFile DataHandler = new ScoreNameToFile();

        string email = DataHandler.GetUserName();
        string score = DataHandler.GetScore();

        string url = "http://cis174-bfrederickson-website.azurewebsites.net/API/v1/highscores/?email=" + email + "&newHighscore=" + score;

        UnityWebRequest www = UnityWebRequest.Post(url, "");

        Debug.Log(www.uri + www.url);
        yield return(www.SendWebRequest());
    }