Street Racing 2D (Game_Controller)

 using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;

using UnityEngine.SceneManagement;


public class Game_Controller : MonoBehaviour

{

    public Text highSoreText;

    public Text scoreText;


    private int score;

    private int highScore;


    public Score_Manager score_manager;


    public GameObject gamePausePanel;

    public GameObject gamePauseButton;


    // Start is called before the first frame update

    void Start()

    {

        gamePausePanel.SetActive(false);

        gamePauseButton.SetActive(true);

    }


    // Update is called once per frame

    void Update()

    {

        highScore = PlayerPrefs.GetInt("high_score");

        score = score_manager.score;


        highSoreText.text = "Highscore: " + highScore.ToString();

        scoreText.text = "Your Score: " + score.ToString();

    }


    public void Restart()

    {

        SceneManager.LoadScene("Game");

    }


    public void PauseGame()

    {

        Time.timeScale = 0;

        gamePausePanel.SetActive(true);

        gamePauseButton.SetActive(false);

    }


    public void ResumeGame()

    {

        Time.timeScale = 1;

        gamePausePanel.SetActive(false);

        gamePauseButton.SetActive(true);

    }


    public void Main_Menu()

    {

        SceneManager.LoadScene("Main_Menu");

    }


    public void RateUs()

    {

        Application.OpenURL("https://play.google.com/store/apps/details?id=com.SanitTech.StreetRacing2D");

    }

}


0 Comments: