// Use this for initialization
    void Start()
    {
        countTouches = 0;
        pauseBtn.SetActive(true);
        animator = GetComponent <Animator> ();   // getting the animator reference


        lastPosition = transform.position;

        boundaries = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0));   // getting player boundaries

        cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript> ();
        fadeScript   = fader.GetComponent <GamePlayFadeScript> ();

        fade1.SetActive(false);
        fade2.SetActive(false);
        showEndScore.SetActive(false);
        endScoreText.SetActive(false);
        endCoinText.SetActive(false);
//		diffText.SetActive (false);
        endSpeedText.SetActive(false);


        easyDifficulty   = GamePreferences.GetEasyDifficultyState();
        mediumDifficulty = GamePreferences.GetMediumDifficultyState();
        hardDifficulty   = GamePreferences.GetHardDifficultyState();

        IsTheGameStartedFromMainMenu();
        IsTheGameResumedAfterPlayerDied();

        Time.timeScale = 0.0f;
        isTheGameStartedFromBegining = true;

        fader.SetActive(false);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        endScoreBG.SetActive(false);

        endScoreTextPosition = endScoreText.rectTransform.localPosition;
        endCoinScorePosition = endCoinText.rectTransform.localPosition;

        endScoreText.rectTransform.localPosition = new Vector3(300, 300, 5);
        endCoinText.rectTransform.localPosition  = new Vector3(300, 300, 5);


        isTheGameStartedFromBegining = true;

        animator = GetComponent <Animator> ();                                        // getting the animator reference

        boundaries = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)); // getting player boundaries

        countTouches = 0;

        fadeScript = fader.GetComponent <GamePlayFadeScript> ();        // fader script reference

        adScript     = GameObject.FindGameObjectWithTag("Ads").GetComponent <AdsScript> ();
        cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript> (); // camera script reference

        lastPosition = transform.position;                                                            // getting the players position

        easyDifficulty   = GamePreferences.GetEasyDifficultyState();
        mediumDifficulty = GamePreferences.GetMediumDifficultyState();
        hardDifficulty   = GamePreferences.GetHardDifficultyState();

        // check if the game was started from main manu to set initial values
        IsTheGameStartedFromMainMenu();

        // check if the game was resumed after player died to continue the game
        IsTheGameResumedAfterPlayerDied();

        Time.timeScale = 0.0f;
    }
    // Use this for initialization
    void Start()
    {
        countTouches = 0;
        pauseBtn.SetActive (true);
        animator = GetComponent<Animator> ();   // getting the animator reference

        lastPosition = transform.position;

        boundaries = Camera.main.ScreenToWorldPoint (new Vector3 (Screen.width, 0, 0)); // getting player boundaries

        cameraScript = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraScript> ();
        fadeScript = fader.GetComponent<GamePlayFadeScript> ();

        fade1.SetActive (false);
        fade2.SetActive (false);
        showEndScore.SetActive (false);
        endScoreText.SetActive (false);
        endCoinText.SetActive (false);
        //		diffText.SetActive (false);
        endSpeedText.SetActive (false);

        easyDifficulty = GamePreferences.GetEasyDifficultyState ();
        mediumDifficulty = GamePreferences.GetMediumDifficultyState ();
        hardDifficulty = GamePreferences.GetHardDifficultyState ();

        IsTheGameStartedFromMainMenu ();
        IsTheGameResumedAfterPlayerDied ();

        Time.timeScale = 0.0f;
        isTheGameStartedFromBegining = true;

        fader.SetActive (false);
    }