Example #1
0
    public void LoadPlayerScore()
    {
        string path1 = Application.persistentDataPath + "/player.snootysobyouare";
        string path2 = Application.persistentDataPath + "/player.verysnooty";

        if (File.Exists(path2))
        {
            stayStill = false;
            PlayerData data = SaveScript.LoadFromCheckPoint();
            previousScore = data.score;
            score         = previousScore;
            ScoreDisplay();
            text.text += previousScore;
            for (i = 0; i < treasureCounter.objects.Length; i++)
            {
                if (data.treasureCollected[i])
                {
                    treasureCounter.chestControllers[i].hasPlayed = true;
                    treasureCounter.OpenTreasure();
                    treasureCounter.chestControllers[i].animChest.Play("ChestOpeningIdle");
                    treasureCounter.treasureCollectedAmount++;
                }
            }
            gameObject.transform.position = checkpoint[data.playerLocation].transform.position;
            //gameObject.transform.position = new Vector3(checkpoint[data.playerLocation].transform.position.x - 2, checkpoint[data.playerLocation].transform.position.y, checkpoint[data.playerLocation].transform.position.z);

            if (isLevel4)
            {
                boulderObject = GameObject.Find("PlayOnAwake");
                boulderAnim   = boulderObject.GetComponent <playOnAwakeLevelFour>();
                boulderAnim.levelFourCheckpoint();
            }
        }
        else if (File.Exists(path1))
        {
            PlayerData data = SaveScript.LoadPlayer();
            previousScore = data.score;
            //ScoreDisplay();
            //text.text += previousScore;
        }
        else
        {
            score         = 0;
            previousScore = 0;
        }
    }