Ejemplo n.º 1
0
    public IEnumerator InitializeScores(int pawnCount, int currentScore, int bestScore)
    {
        var starImage = starObject.GetComponent <Image>();

        starImage.gameObject.SetActive(false);

        if (pawnCount == 1)
        {
            starImage.gameObject.SetActive(true);
            starImage.sprite = starSprites[2];
            currentScore    += (starScore * 3);

            yield return(new WaitForSeconds(1f));

            ShowInstantMessage("+{0}".F(starScore * 3));
            yield return(new WaitForSeconds(1f));

            SetCurrentScore(currentScore);
        }
        else if (pawnCount == 2)
        {
            starImage.gameObject.SetActive(true);
            starImage.sprite = starSprites[1];
            currentScore    += (starScore * 2);

            yield return(new WaitForSeconds(1f));

            ShowInstantMessage("+{0}".F(starScore * 2));
            yield return(new WaitForSeconds(1f));

            SetCurrentScore(currentScore);
        }
        else if (pawnCount == 3)
        {
            starImage.gameObject.SetActive(true);
            starImage.sprite = starSprites[0];
            currentScore    += (starScore * 1);

            yield return(new WaitForSeconds(1f));

            ShowInstantMessage("+{0}".F((starScore * 1)));
            yield return(new WaitForSeconds(1f));

            SetCurrentScore(currentScore);
        }

        if (currentScore > bestScore)
        {
            yield return(new WaitForSeconds(1f));

            ShowInstantMessage("New Best Score\n{0}".F(currentScore));
            yield return(new WaitForSeconds(1f));

            SetBestScore(currentScore);
            PlayerPrefs.SetInt("BestScore", currentScore);
            SocialScript.ReportScore(currentScore);
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        var backgroundMusic = GameObject.FindGameObjectWithTag("BackgroundMusic");

        if (backgroundMusic == null)
        {
            var position = Camera.main.gameObject.transform.position;
            Instantiate(BackgroundMusicPrefab, position, Quaternion.identity);
        }

        BackgroundAudio.PlayLoadSound2();
        SocialScript.Activate();
    }
Ejemplo n.º 3
0
 public void SocialButton_Click()
 {
     if (SocialScript.Authenticated)
     {
         MessageScript.Show("Are you sure want to sign out?", MessageBoxButton.YesNo, delegate(MessageBoxResult result) {
             if (result == MessageBoxResult.Yes)
             {
                 SocialScript.SignOut();
             }
         });
     }
     else
     {
         SocialScript.Authenticate();
     }
 }
Ejemplo n.º 4
0
 public void ScoreButton_OnClick()
 {
     SocialScript.AuthenticateAndShow();
 }