Пример #1
0
    // Use this for initialization
    void Start()
    {
        SelectedLevelScript.selectedLevel = 0;
        if (showCount > 0)
        {
            AdHandlerScript.showBanner();
        }

        showCount++;
    }
Пример #2
0
	void checkStartup()
	{
		if (!CarScript.stopped)
			return;

		if (showingNumber > 3) 
		{
			Destroy(numberObject, 0.1f);
			numberObject = (GameObject) GameObject.Instantiate(Resources.Load("Number3", typeof(GameObject)));
			showingNumber = 3;
		}
		if (startTimer > 1 && showingNumber == 3) 
		{
			Destroy(numberObject, 0.1f);
			numberObject = (GameObject) GameObject.Instantiate(Resources.Load("Number2", typeof(GameObject)));
			showingNumber = 2;
		}
		if (startTimer > 2 && showingNumber == 2) 
		{
			Destroy(numberObject, 0.1f);
			numberObject = (GameObject) GameObject.Instantiate(Resources.Load("Number1", typeof(GameObject)));
			showingNumber = 1;
		}
		if (startTimer > 2.8f && showingNumber == 1) 
		{
			Destroy(numberObject, 0.1f);
			numberObject = (GameObject) GameObject.Instantiate(Resources.Load("Number0", typeof(GameObject)));
			showingNumber = 0;
			Destroy(numberObject, 0.8f);
			AdHandlerScript.hideBanner();
		}
		numberObject.transform.position = new Vector3(0,0,-3);
		startTimer += Time.deltaTime;

		float scaling = 5 * Time.deltaTime;
		numberObject.transform.localScale = new Vector3(numberObject.transform.localScale.x + scaling,numberObject.transform.localScale.y+scaling,numberObject.transform.localScale.z);
		if (startTimer > 3) 
		{
			AdHandlerScript.hideBanner();

			CarScript.stopped = false;
			goCount++;
			if (goCount == 3 || goCount == 30) 
			{
				videoAdToBeShown = true;
			}
			if (goCount == 10 || goCount == 50) 
			{
				interstitialToBeShown = true;
			}
			if(numberObject)
				Destroy(numberObject, 0.8f);
		}
	}
Пример #3
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();
	}
Пример #4
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;
		}
	}
Пример #5
0
 void OnApplicationQuit()
 {
     AdHandlerScript.DestroyAds();
 }