Beispiel #1
0
    public static void GameOver()
    {
        Movement.Player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll;
        End_Panel.SetActive(true);
        GameOver_Panel.SetActive(false);
        Revive_Panel.SetActive(true);

        AdManager.AdManage.Show_Banner();

        game_over     = true;
        restart_timer = 5f;

        if (instance.internet_connection)
        {
            if (instance.restart_enabled && AdManager.AdManage.rewardedAd.IsLoaded())
            {
                instance.StartCoroutine(instance.RestartTimerCountdown());
            }
            else
            {
                instance.GameEnded();
            }
        }
        else
        {
            instance.GameEnded();
        }
    }
    public static void GameOver()
    {
        AdManager.AdManage.Show_Banner();

        if (instance.restart_enabled && instance.internet_connection && AdManager.AdManage.rewardedAd.IsLoaded())
        {
            End_Panel.SetActive(true);
            GameOver_Panel.SetActive(false);
            Revive_Panel.SetActive(true);

            game_over_menu = true;
            game_over      = true;
            restart_timer  = 5f;

            instance.StartCoroutine(instance.RestartTimerCountdown());
        }
        else
        {
            game_over_menu = true;
            game_over      = true;
            End_Panel.SetActive(true);
            instance.GameEnded();
        }

        AdManager.AdManage.Request_Interstitial();
        AdManager.AdManage.Request_Reward();
    }
    public void GameEnded()
    {
        AdManager.AdManage.bannerView.Destroy();

        Revive_Panel.SetActive(false);
        GameOver_Panel.SetActive(true);
        game_over = false;
        //game_over_menu = true;
        Calculate_Coin();
        Save_Coin();
        Score_UI.text = Movement.ins.score.ToString("F0");
        Coin_UI.text  = current_coins.ToString("F0");

        PlayerDataHighscore loadedDataHighscore = SaveLoadHighscore.LoadPlayer();
        var temp_highscore = loadedDataHighscore.highscore;

        if (Movement.ins.score > temp_highscore)
        {
            Score_Text.text = "NEW HIGHSCORE";
            PlayerDataHighscore SaveDataHighscore = new PlayerDataHighscore();
            SaveDataHighscore.highscore = Movement.ins.score;
            SaveLoadHighscore.SavePlayer(SaveDataHighscore);
        }
        else
        {
            Score_Text.text = "HIGHSCORE";
        }
    }
    public void Revive_Success()
    {
        game_over_menu = false;
        AdManager.AdManage.bannerView.Destroy();
        End_Panel.SetActive(false);
        GameOver_Panel.SetActive(false);
        Revive_Panel.SetActive(false);

        Movement.ins.GameSound.Play();
        Movement.ins.ResetPlayer();
        game_over_menu = false;
    }
Beispiel #5
0
    public void GameEnded()
    {
        AdManager.AdManage.bannerView.Destroy();

        Revive_Panel.SetActive(false);
        Calculate_Coin();

        string Highscore_Current = Movement.current_score.ToString("F0");

        Score_UI.text = Highscore_Current;

        // Get current score as int.
        int highscore_current = int.Parse(Highscore_Current);

        PlayerData loadedData          = SaveLoad.LoadPlayer();
        string     Highscore_Total_str = loadedData.highscore.ToString();

        // Get highscore as int.
        int Highscore_Total = int.Parse(Highscore_Total_str);

        HighScore_Text.text = "HIGHSCORE";

        // Check if highscore is bigger than current score.
        if (highscore_current > Highscore_Total)
        {
            HighScore_Text.text = "NEW HIGHSCORE";
            // Save new highscore.
            PlayerData.HighPoint.highscore_total = highscore_current;
            PlayerData saveData = new PlayerData();
            saveData.highscore = PlayerData.HighPoint.highscore_total;
            SaveLoad.SavePlayer(saveData);
        }

        GameOver_Panel.SetActive(true);
        game_over = false;
    }