Пример #1
0
    public void OnDeath(bool collision)
    {
        isDead = true;
        print("GameOver");
        //// TODO: Your Implementation:
        //// 1. show DeathMenu (Hint: you can use Show() in DeathMenu.cs)
        //// 2. stop player
        //// 3. hide all tiles (Hint: call function in TileManager.cs)
        //// 4. record high score (Hint: use PlayerPrefs)
        ///

        float highScore = PlayerPrefs.GetFloat("highScore");

        highScore = score > highScore ? score : highScore;
        PlayerPrefs.SetFloat("highScore", highScore);

        deathMenu.Show(score);
    }
Пример #2
0
    public void OnDeath()
    {
        GameController GameScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();

        if (GameScript.DeathCount >= 0)
        {
            GameScript.DeathCount = 0;
            Hide();
            RewardedAdsMenu.Show();

            return;
        }

        GameScript.DeathCount++;

        Hide();
        DeathMenu.Show();
    }
Пример #3
0
    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            GameController GameScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
            GameScript.points *= 2;

            Hide();
            DeathMenu.Show();

            // Reward the user for watching the ad to completion.
        }
        else if (showResult == ShowResult.Skipped)
        {
            Hide();
            DeathMenu.Show();
            // Do not reward the user for skipping the ad.
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }
Пример #4
0
 public override void OnBackPressed()
 {
     Hide();
     DeathMenu.Show();
 }