Пример #1
0
    // pause Button Function
    void Start()
    {
        Time.timeScale = 1;
        scaleFactor    = ScaleFactor.GetScaleFactor();
        pauseButton    = UIButton.create(buttonsManager, "pause_active2.png", "pause_normal2.png", 0, 0);
        resumeButton   = UIButton.create(buttonsManager, "play_active.png", "play_normal2.png", 0, 0);
        replayButton   = UIButton.create(buttonsManager, "resume_normal.png", "resume_active.png", 0, 0);
        homeButton     = UIButton.create(buttonsManager, "home_normal.png", "home_active.png", 0, 0);

        pauseDefaultx = pauseButton.width / scaleFactor * 1f;
        pauseDefaultY = pauseButton.height / scaleFactor * 1f;
        pauseButton.positionFromTopLeft(0.24f, 0.9f);
        pauseButton.setSize(pauseButton.width / scaleFactor * 1f, pauseButton.height / scaleFactor * 1f);

        resumeButton.setSize(resumeButton.width / scaleFactor * 1f, resumeButton.height / scaleFactor * 1f);
        replayButton.setSize(replayButton.width / scaleFactor * 1f, replayButton.height / scaleFactor * 1f);
        homeButton.setSize(homeButton.width / scaleFactor * 1f, homeButton.height / scaleFactor * 1f);

        currentPosX = objectCamera.transform.position.x;
        currentPosY = objectCamera.transform.position.y;
        currentPosZ = objectCamera.transform.position.z;

        pauseButton.onTouchUpInside  += sender3 => Time.timeScale = 0;
        replayButton.onTouchUpInside += sender1 => Application.LoadLevel("Level1");
        replayButton.onTouchUpInside += sender1 => audioplay.PlayGameMusic();
        replayButton.onTouchUpInside += sender1 => AudioScript.status = false;
        homeButton.onTouchUpInside   += sender2 => Application.LoadLevel("AGAIN");
        resumeButton.onTouchUpInside += sender3 => Time.timeScale = 1;

        pauseButton.touchDownSound  = audioplay.getSoundClip();
        replayButton.touchDownSound = audioplay.getSoundClip();
        homeButton.touchDownSound   = audioplay.getSoundClip();
        resumeButton.touchDownSound = audioplay.getSoundClip();

        replayButton.positionFromTopLeft(2f, 2f);
        homeButton.positionFromTopLeft(2f, 2f);
        resumeButton.positionFromTopLeft(2f, 2f);
    }
Пример #2
0
    void Start()
    {
        //PlayerPrefs.SetInt("High Score", 0);

        if (score > highScore)
        {
            highScore = score;
            PlayerPrefs.SetInt("High Score", highScore);
        }

        if (audioplay != null && AudioScript.status == true)
        {
            audioplay.PlayGameMusic();
        }
        AudioScript.status = true;
        print("Width " + Screen.width + " Height " + Screen.height);
        var Scores = gameObject.GetComponent <Score>();

        Time.timeScale = 1;
        switch (Application.loadedLevelName)
        {
        case "Level1":
            Basket basketObject = GameObject.Find("basketBody").GetComponent <Basket>();
            basketObject.resetScore();
            level = 1;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(15);
            Scores.setScore(score);
            break;

        case "Level2":
            level = 2;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(30);
            Scores.setScore(score);
            break;

        case "Level3":
            level = 3;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(45);
            Scores.setScore(score);
            break;

        case "Level4":
            level = 4;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(60);
            Scores.setScore(score);
            break;

        case "Level5":
            level = 5;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(75);
            Scores.setScore(score);
            break;

        case "Level6":
            level = 6;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(90);
            Scores.setScore(score);
            break;

        case "Level7":
            level = 7;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(105);
            Scores.setScore(score);
            break;

        case "Level8":
            level = 8;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(120);
            Scores.setScore(score);
            break;

        case "Level9":
            level = 9;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(135);
            Scores.setScore(score);
            break;

        case "Level10":
            level = 10;
            Timer.SetTimer(1, 30);
            Scores.SetTargetScore(150);
            Scores.setScore(score);
            break;
        }
    }