示例#1
0
 // Use this for initialization
 void Start()
 {
     //for exite button disable in IOS
             #if UNITY_IOS
     ExitButton.SetActive(false);
             #endif
 }
示例#2
0
 public void OnClickResumeButton()
 {
     Time.timeScale = 1f; //Oyun devam ediyor
     ResumeButton.SetActive(false);
     RestartButton.SetActive(false);
     ExitButton.SetActive(false);
 }
示例#3
0
 public void StartButtonRemove()
 {
     StartButton.SetActive(false);
     ExitButton.SetActive(false);
     EscButton.SetActive(true);
     RstButton.SetActive(true);
 }
示例#4
0
    void Update()
    {
        ScoreLeft.text  = "" + scoreLeft;
        ScoreRight.text = "" + scoreRight;

        //ScoreLeft.text = ""+ scoreLeft; //ScoreLeft Metnini güncel skor ile güncelle
        //ScoreRight.text = "" + scoreRight; //ScoreRight Metnini güncel skor ile güncelle
        if (scoreLeft == 10 || scoreRight == 10)
        {
            Time.timeScale = 0f;
            RestartButton.SetActive(true);
            ExitButton.SetActive(true);
            DeveloperText.SetActive(true);
            LoserText.SetActive(true);
            if (scoreRight == 10)
            {
                loserText.text = "Loser: Left Side";
            }
            else if (scoreLeft == 10)
            {
                loserText.text = "Loser: Right Side";
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Time.timeScale = 0f; //Oyun duraklatıldı
            ResumeButton.SetActive(true);
            ExitButton.SetActive(true);
            RestartButton.SetActive(true);
        }
    }
示例#5
0
 public void MenuHide()
 {
     MenuReset();
     StartButton.SetActive(false);
     OptionButton.SetActive(false);
     ExitButton.SetActive(false);
     serverListIsShown = false;
 }
示例#6
0
 public void helpBackClicked()
 {
     HelpText.SetActive(false);
     HelpBackButton.SetActive(false);
     StartButton.SetActive(true);
     CreditsButton.SetActive(true);
     ExitButton.SetActive(true);
     HelpButton.SetActive(true);
 }
示例#7
0
 public void creditsClicked()
 {
     BackCreditsButton.SetActive(true);
     CreditsText.SetActive(true);
     StartButton.SetActive(false);
     CreditsButton.SetActive(false);
     ExitButton.SetActive(false);
     HelpButton.SetActive(false);
 }
示例#8
0
 void LobbyActive()
 {
     StartButton.SetActive(false);
     OptionButton.SetActive(false);
     ExitButton.SetActive(false);
     hostOn.SetActive(false);
     joinOn.SetActive(false);
     TiltButton.SetActive(false);
     MuteButton.SetActive(false);
     OnOffButton.SetActive(false);
     lobbyActive = true;
 }
示例#9
0
    public void GameOver()  //遊戲失敗函式,以ShipController呼叫
    {
        Instantiate(BoomSound);
        IsPlaying = false;
        HpText.SetActive(false);
        ReButtonSmall.SetActive(false);
        ReTextSmall.SetActive(false);
        ExitButtonSmall.SetActive(false);
        ExitTextSmall.SetActive(false);

        OverTitle.SetActive(true);
        ReButton.SetActive(true);
        ReText.SetActive(true);
        ExitButton.SetActive(true);
        ExitText.SetActive(true);
    }
示例#10
0
    void Succeed()   //通關函式,在通關後一小段間隔跳出通關文字
    {
        EndTime += Time.deltaTime;

        if (EndTime > 1)
        {
            ReButtonSmall.SetActive(false);
            ReTextSmall.SetActive(false);
            ExitButtonSmall.SetActive(false);
            ExitTextSmall.SetActive(false);

            GoodText.SetActive(true);
            ReButton.SetActive(true);
            ReText.SetActive(true);
            ExitButton.SetActive(true);
            ExitText.SetActive(true);
        }
    }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
        {
            Click(Input.GetTouch(0).position);
        }
        else if (Input.GetMouseButtonUp(0))
        {
            Click(Input.mousePosition);
        }
        if (initMenu == true)
        {
            lobbyActive = false;
            StartButton.SetActive(true);
            OptionButton.SetActive(true);
            ExitButton.SetActive(true);
            initMenu = false;
        }

        if (lobbyActive)
        {
            SetBackButtonEnable(true);
        }

        if (serverListIsShown)
        {
            serverListRefreshTimer += Time.deltaTime;
            if (serverListRefreshTimer > 1.0f)
            {
                serverListRefreshTimer = 0;
                GlobalStorage.GetComponent <NetworkManager>().StartCoroutine("refreshHostList");
            }
        }

        if (nameClicked && Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            SavePreferences();
            MenuReset();
        }
        //NetworkManagerSc.GetComponent<NetworkManager> ().StartCoroutine ("refreshHostList");
        //StartCoroutine("refreshHostList");
    }
示例#12
0
 public void MenuReset()
 {
     hostOn.SetActive(false);
     joinOn.SetActive(false);
     NameButton.SetActive(false);
     TiltButton.SetActive(false);
     SetBackButtonEnable(false);
     optionsClicked    = false;
     startClicked      = false;
     nameClicked       = false;
     hostClicked       = false;
     serverListIsShown = false;
     MuteButton.SetActive(false);
     OnOffButton.SetActive(false);
     gameObject.GetComponent <SplashScreen> ().Hide();
     gameObject.GetComponent <SplashScreen> ().SetText("No Text");
     if (lobbyActive)
     {
         lobbyActive = false;
     }
     StartButton.SetActive(true);
     OptionButton.SetActive(true);
     ExitButton.SetActive(true);
 }
示例#13
0
    // Update is called once per frame
    void Update()
    {
        coinsTex.text = "Coins: " + coins;



        if (NoADS.ads == 0)
        {
            if (startAd == 0)
            {
                if (ad)
                {
                    timer3 += Time.deltaTime;
                    if (timer3 >= 1)
                    {
                        if (rand)
                        {
                            showVid = Random.Range(0, 3);
                            rand    = false;
                        }


                        if (showVid == 1)
                        {
                            if (Appodeal.isLoaded(Appodeal.VIDEO))
                            {
                                timer3  = 0;
                                startAd = 5;
                                PlayerPrefs.SetInt("startAD", startAd);

                                Appodeal.show(Appodeal.VIDEO);
                                ad = false;
                            }
                        }
                        else
                        {
                            timer3  = 0;
                            ad      = false;
                            startAd = 5;
                            PlayerPrefs.SetInt("startAD", startAd);
                            AppnextVideoAndroid.showInterstitial("feb28299-00d1-4c17-a5f5-79f33cfda3bb", AppnextVideoAndroid.INTERSTITIAL);
                        }
                    }
                }
            }
        }


        if (musicOn == 1)
        {
            if (Music2)
            {
                Destroy(Music2);
            }
        }
        else
        {
            if (!Music2)
            {
                Instantiate(Music, Music.transform.position, Music.transform.rotation);
                Music2 = GameObject.FindGameObjectWithTag("music");
                DontDestroyOnLoad(Music2);
            }
        }


        if (sfxON == 0)
        {
            if (coinSound)
            {
                coinSound = false;
                Instantiate(CoinSFX, CoinSFX.transform.position, CoinSFX.transform.rotation);
                CoinSFX2 = GameObject.FindGameObjectWithTag("SFX");
                SFX      = CoinSFX2.GetComponent <AudioSource> ();
            }
        }

        if (SFX)
        {
            if (!SFX.isPlaying)
            {
                Destroy(CoinSFX2);
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            timer = 0;
            if (!earnMoneyOn)
            {
                game2 = true;
            }
            buttonDown = true;
        }



        if (buttonDown)
        {
            if (!game)
            {
                timer += Time.deltaTime;
                if (timer >= 0.5f)
                {
                    buttonDown = false;
                    timer      = 0;

                    if (exitOn)
                    {
                        Application.Quit();
                    }

                    if (game2)
                    {
                        RateBut.SetActive(false);
                        PrizesBut.SetActive(false);
                        earnCoinBut.SetActive(false);
                        distanceText.SetActive(true);
                        coinsText.SetActive(true);
                        RecordText.SetActive(false);
                        coinsText2.SetActive(false);
                        Appodeal.hide(Appodeal.BANNER_TOP);
                        ExitButton.SetActive(false);
                        sfxToggle.SetActive(false);
                        musicToggle.SetActive(false);
                        TapToPlay.SetActive(false);
                        shop.SetActive(false);
                        leaders.SetActive(false);
                        achievements.SetActive(false);
                        NoAds.SetActive(false);
                        Instantiate(balls [iBall], new Vector3(0, 1, 0), balls [iBall].transform.rotation);
                        Instantiate(tiltControll, tiltControll.transform.position, tiltControll.transform.rotation);
                        balls [iBall] = GameObject.FindGameObjectWithTag("Ball");
                        game          = true;
                    }
                }
            }
        }



        if (game)
        {
            cameraPos = transform.position;



            if (exitOn)
            {
                timer += Time.deltaTime;
                if (timer >= 0.5f)
                {
                    Application.Quit();
                }
            }


            if (isDestroy)
            {
                isDestroy = false;

                targetZ += 20;
                newPosition.Set(0, 0, targetZ);

                i = Random.Range(0, 47);
                Instantiate(parts [i], newPosition, parts [i].transform.rotation);

                i2 = Random.Range(0, 3);
                if (i2 == 1)
                {
                    i = Random.Range(0, 47);
                    Instantiate(parts [i], newPosition, parts [i].transform.rotation);
                }
            }

            if (balls [iBall])
            {
                if (balls [iBall].transform.position.y <= -20)
                {
                    if (NoADS.ads == 0)
                    {
                        Appodeal.show(Appodeal.BANNER_TOP);
                    }
                    ad = true;
                    if (done)
                    {
                        done = false;
                        if (startAd > 0)
                        {
                            startAd -= 1;
                        }
                    }
                    PlayerPrefs.SetInt("startAD", startAd);
                    gameOverCanv.SetActive(true);
                    mainCanv.SetActive(false);
                    PlayerPrefs.SetInt("coins", coins);
                }
            }



            newZ = transform.position.z;


            cameraPosition.Set(0, 35, newZ + speed);
            skyPosition.Set(0, -10, newZ + speed);
            sky.position       = skyPosition;
            transform.position = cameraPosition;
            if (speed < 0.037f)
            {
                speed += 0.000007f;
            }
        }



        if (tapPlayOn)
        {
            if (!game)
            {
                timer2 += Time.deltaTime;
                if (timer2 >= 1)
                {
                    timer2 = 0;

                    if (TapToPlay.activeSelf)
                    {
                        TapToPlay.SetActive(false);
                    }
                    else
                    {
                        TapToPlay.SetActive(true);
                    }
                }
            }
        }
    }