Beispiel #1
0
 private void OnDisable()
 {
     Debug.Log("Save in disable");
     if (progress > SPlayerPrefs.GetFloat("Progress_" + lvlCount))
     {
         Debug.Log("Save " + progress);
         SPlayerPrefs.SetFloat("Progress_" + lvlCount, progress);
         SPlayerPrefs.Save();
     }
 }
    void Start()
    {
        jumps     = GameObject.Find("Jumps");
        attempts  = GameObject.Find("Attempts");
        percent   = GameObject.Find("Percentage");
        playOrBuy = GameObject.Find("PlayOrBuy");
        //Min amount of jumps to complete the lvl
        lvlCount = SPlayerPrefs.GetInt("Count");
        //Первые две карты изначально открыты
        SPlayerPrefs.SetInt("Buyed_0", 1);
        SPlayerPrefs.SetInt("Buyed_1", 1);
        SPlayerPrefs.Save();

        if (SPlayerPrefs.HasKey("Jumps_" + lvlCount))
        {
            lvlJumps = SPlayerPrefs.GetInt("Jumps_" + lvlCount);
        }
        else
        {
            SPlayerPrefs.SetInt("Jumps_" + lvlCount, 0);
        }
        if (SPlayerPrefs.HasKey("Attempts_" + lvlCount))
        {
            lvlAttempts = SPlayerPrefs.GetInt("Attempts_" + lvlCount);
        }
        else
        {
            SPlayerPrefs.SetInt("Attempts_" + lvlCount, 0);
        }
        if (SPlayerPrefs.HasKey("Progress_" + lvlCount))
        {
            progress = SPlayerPrefs.GetFloat("Progress_" + lvlCount);
        }
        else
        {
            SPlayerPrefs.SetFloat("Progress_" + lvlCount, 0);
        }
        if (SPlayerPrefs.HasKey("Buyed_" + lvlCount))
        {
            lvlBuyed = SPlayerPrefs.GetInt("Buyed_" + lvlCount);
        }
        else
        {
            SPlayerPrefs.SetInt("Buyed_" + lvlCount, 0);
        }
        if (SPlayerPrefs.HasKey("Money"))
        {
            money = SPlayerPrefs.GetInt("Money");
        }
        else
        {
            SPlayerPrefs.SetInt("Money", 0);
        }
    }
Beispiel #3
0
    //Логика уничтожения объектов на сцене
    public void destroyScene()
    {
        StartCoroutine(createPlayerExplosion(gameObject));

        //Запись лучшего счета
        if (SPlayerPrefs.GetFloat("Score") < GameObject.Find("Score").GetComponent <ScoreCounter>().score)
        {
            SPlayerPrefs.SetFloat("Score", GameObject.Find("Score").GetComponent <ScoreCounter>().score);
            SPlayerPrefs.Save();
        }

        Destroy(gameObject);

        GameObject[] heads       = GameObject.FindGameObjectsWithTag("EnemyHead");
        GameObject[] headSprites = GameObject.FindGameObjectsWithTag("HeadSprite");
        GameObject[] backs       = GameObject.FindGameObjectsWithTag("Back");
        GameObject[] tails       = GameObject.FindGameObjectsWithTag("Tail");

        foreach (GameObject head in heads)
        {
            StartCoroutine(createExplosion(head));
            Destroy(head);
        }

        foreach (GameObject headSprite in headSprites)
        {
            Destroy(headSprite);
        }

        foreach (GameObject back in backs)
        {
            StartCoroutine(createExplosion(back));
            Destroy(back);
        }

        foreach (GameObject tail in tails)
        {
            StartCoroutine(createExplosion(tail));
            Destroy(tail);
        }

        EnemyHead.speed = 0;

        GameStatus.gameStatus = "GameOver";
    }
Beispiel #4
0
 void Start()
 {
     if (SPlayerPrefs.HasKey("Count"))
     {
         lvlCount = SPlayerPrefs.GetInt("Count");
     }
     else
     {
         SPlayerPrefs.SetInt("Count", 0);
     }
     if (SPlayerPrefs.HasKey("Progress_" + lvlCount))
     {
         progress = SPlayerPrefs.GetFloat("Progress_" + lvlCount);
     }
     else
     {
         SPlayerPrefs.SetFloat("Progress_" + lvlCount, 0);
     }
     player = GameObject.Find("Player").transform;
 }
Beispiel #5
0
 void OnMouseUp()
 {
     content = "My record in Cut and Dodge " + System.Math.Round(SPlayerPrefs.GetFloat("Score")) + ".\n Try to beat my score\n https://play.google.com/store/apps/details?id=com.abadek.cutanddodge";
     CallShare(title, "", content);
 }
Beispiel #6
0
 void Start()
 {
     gameObject.GetComponent <Text> ().text = (float)System.Math.Round(SPlayerPrefs.GetFloat("Score")) + "";
 }
Beispiel #7
0
    void Start()
    {
        isCourStarted = false;

        tempScore = (float)System.Math.Round(SPlayerPrefs.GetFloat("Score"));
    }
Beispiel #8
0
 void Update()
 {
     if (GameStatus.gameStatus == "GameOver" && tempScore < (float)System.Math.Round(SPlayerPrefs.GetFloat("Score")))
     {
         if (!isCourStarted)
         {
             StartCoroutine(showText());
         }
     }
 }