Ejemplo n.º 1
0
 void DataSaveAndLoad()
 {
     /**PlayerPrefs.SetString("PlayerName", "");
      * PlayerPrefs.Save();
      * PlayerPrefs.SetInt("TempScore", 0);
      * PlayerPrefs.Save();
      * PlayerPrefs.SetInt("GameLv", 0);
      * PlayerPrefs.Save();
      * PlayerPrefs.SetInt("Bonus", 0);
      * PlayerPrefs.Save();
      * PlayerPrefs.SetInt("TotalScore", 0);
      * PlayerPrefs.Save();**/
     TempScore  = PlayerPrefs.GetInt("TotalScore");
     HighScore  = PlayerPrefs.GetInt("HighScore");
     Moves.text = "Moves Remaining : " + MoveRemaining.ToString();
     Score.text = "Score : " + TempScore.ToString();
     Source     = GetComponent <AudioSource>();
 }
Ejemplo n.º 2
0
    IEnumerator Check()
    {
        yield return(new WaitForSeconds(0.3f));

        if (FirstIndex != SecondIndex && FirstName == SecondName)
        {
            BtnList[FirstIndex].interactable  = false;
            BtnList[SecondIndex].interactable = false;

            BtnList[FirstIndex].image.color  = new Color(0, 0, 0, 0);
            BtnList[SecondIndex].image.color = new Color(0, 0, 0, 0);

            Source.PlayOneShot(RightSound);
            TempScore += 20;
            MoveRemaining--;
            MatchGuess++;
        }
        else if (FirstIndex == SecondIndex)
        {
            BtnList[FirstIndex].image.sprite  = BgImage;
            BtnList[SecondIndex].image.sprite = BgImage;
        }
        else
        {
            BtnList[FirstIndex].image.sprite  = BgImage;
            BtnList[SecondIndex].image.sprite = BgImage;

            Source.PlayOneShot(WrongSound);
            TempScore -= 5;
            MoveRemaining--;
        }
        FirstClick = SecondClick = false;
        if (TempScore <= 0)
        {
            TempScore = 0;
            // Score.text ="Score :" + TempScore.ToString();
        }

        Moves.text = "Move Remaining : " + MoveRemaining.ToString();
        Score.text = "Score :" + TempScore.ToString();
        CheckFinish();
    }