Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        SelectedLevelScript.selectedLevel = 0;
        if (showCount > 0)
        {
            AdHandlerScript.showBanner();
        }

        showCount++;
    }
Exemplo n.º 2
0
	// Use this for initialization
	void Start () {
		lblStyle.fontSize = 24;
		lblStyle.alignment = TextAnchor.MiddleCenter;
		HighScoreScript hsScript = (HighScoreScript) gameObject.GetComponent(typeof(HighScoreScript));
		//hsScript.Save(); // This will reset highscores
		hsScript.Load();

		highScore1 = hsScript.highScores.highscore1;
		highScore2 = hsScript.highScores.highscore2;
		highScore3 = hsScript.highScores.highscore3;
		highScore4 = hsScript.highScores.highscore4;
		highScore5 = hsScript.highScores.highscore5;

		scrollStarted = false;
		scrollXValue = 0;
		AdHandlerScript.showBanner();
	}
Exemplo n.º 3
0
	void DoGameOverWindow(int windowID) {

		if (!AdHandlerScript.bannerVisible)
		{
			AdHandlerScript.showBanner();
		}

		GUI.skin = mainSkin;
		GUI.skin.button.fontSize = 22 * Screen.height / 800;

		float btnHeight = Screen.height / 16;
		float btnWidth = Screen.width / 4;
		float lblStartY = btnHeight;
		float btnStartY = Screen.width / 2 + 1.6f*btnHeight;

		lblStyleBig.fontSize = 34 * Screen.height / 800;
		lblStyle.fontSize = 26 * Screen.height / 800;

		GUI.Label(new Rect(Screen.width / 2 -1.3f*btnWidth, Screen.height / 10, 2*btnWidth, btnHeight), "GAME OVER!", lblStyleBig);

		GUI.Label(new Rect(Screen.width / 2 -1.0f*btnWidth, Screen.height / 10+1.5f*btnHeight, 2*btnWidth, btnHeight), "SCORE: "+ CarScript.score.ToString(), lblStyle);

		HighScoreScript hsScript = (HighScoreScript) gameObject.GetComponent(typeof(HighScoreScript));

		int hsScore = 0;
		if (SelectedLevelScript.selectedLevel == 1) 
		{
			hsScore = hsScript.highScores.highscore1;
		}
		else if (SelectedLevelScript.selectedLevel == 2) 
		{
			hsScore = hsScript.highScores.highscore2;
		}
		else if (SelectedLevelScript.selectedLevel == 3) 
		{
			hsScore = hsScript.highScores.highscore3;
		}
		else if (SelectedLevelScript.selectedLevel == 4) 
		{
			hsScore = hsScript.highScores.highscore4;
		}
		else if (SelectedLevelScript.selectedLevel == 5) 
		{
			hsScore = hsScript.highScores.highscore5;
		}
		int carScore = CarScript.score;

		if (hsScore <= carScore) 
		{
			GUI.Label (new Rect (Screen.width / 2 - 1.5f * btnWidth, Screen.height / 10 + 3f * btnHeight, btnWidth*5, btnHeight), "THAT'S A HIGHSCORE!", lblStyle);

			if (SelectedLevelScript.selectedLevel == 1) 
			{
				hsScript.highScores.highscore1 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 2) 
			{
				hsScript.highScores.highscore2 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 3) 
			{
				hsScript.highScores.highscore3 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 4) 
			{
				hsScript.highScores.highscore4 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 5) 
			{
				hsScript.highScores.highscore5 = carScore;
			}
			hsScript.Save();
		}

		if (GUI.Button(new Rect(Screen.width / 2 -btnWidth, btnStartY, btnWidth, 1.2f*btnHeight), " RESTART"))
			Application.LoadLevel("GameScene");

		if (GUI.Button(new Rect(Screen.width / 2 -btnWidth, btnStartY+2*btnHeight, btnWidth, 1.2f*btnHeight), "  BACK"))
			Application.LoadLevel("LevelScene");

		if (videoAdToBeShown)
		{
			AdHandlerScript.showVideoAd();
			videoAdToBeShown = false;
		}
		if (interstitialToBeShown)
		{
			AdHandlerScript.showInterstitial();
			interstitialToBeShown = false;
		}
	}