コード例 #1
0
    void ShowWinScreen()
    {
        textKeyPrice1.text = textKeyPrice2.text = ((3 - keysCollected) * 800).ToString();

        if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
        {
            PlaySounds.Stop_BackgroundMusic_Gameplay();
        }
        PlaySounds.Play_Level_Completed_Popup();
        Win_CompletedScreenHolder.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y - 3, Win_CompletedScreenHolder.transform.position.z);
        Win_CompletedScreenHolder.SetActive(true);
        Win_ShineHolder.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Win_ShineHolder.transform.position.z);
        Win_CompletedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FinishTableShow");

        StartCoroutine(CheckKeys());

        //StartCoroutine(waitForStars());
    }
コード例 #2
0
ファイル: Loading.cs プロジェクト: bigstupidx/banana
    void Start()
    {
        gameObject.name = "LOADING ZA BRISANJE";
        DontDestroyOnLoad(this.gameObject);
        if (StagesParser.LoadingPoruke.Count == 0)
        {
            StagesParser.LoadingPoruke.Clear();
            StagesParser.RedniBrojSlike.Clear();
            StagesParser.Instance.UcitajLoadingPoruke();
        }

        transform.Find("Loading Animation Tip-s/Loading sa Tip-om/Loading Text").GetComponent <TextMesh>().text = LanguageManager.Loading;
        transform.Find("Loading Animation Tip-s/Loading sa Tip-om/Loading Text").GetComponent <TextMeshEffects>().RefreshTextOutline(false, true);

        RandomBroj = Random.Range(1, StagesParser.LoadingPoruke.Count);

        PozadinaText = GameObject.Find("Tip Text").GetComponent <TextMesh>();

        //1-Do not miss tips and tricks, 2-Want to keep playing? Spend banana... , 3-Jump on enemies' heads...
        if (StagesParser.loadingTip == 1)
        {
            PozadinaText.text = LanguageManager.LoadingTip1;
            PozadinaText.GetComponent <TextMeshEffects>().RefreshTextOutline(true, true, false);
            GameObject Background = Instantiate(Resources.Load("LoadingBackground/BgP8")) as GameObject;
            Background.transform.parent = GameObject.Find("Loading Tip BG").transform;
            RandomBroj = 8;
        }
        else if (StagesParser.loadingTip == 2)
        {
            PozadinaText.text = LanguageManager.LoadingTip2;
            PozadinaText.GetComponent <TextMeshEffects>().RefreshTextOutline(true, true, false);
            GameObject Background = Instantiate(Resources.Load("LoadingBackground/BgP5")) as GameObject;
            Background.transform.parent = GameObject.Find("Loading Tip BG").transform;
            RandomBroj = 5;
        }
        else if (StagesParser.loadingTip == 3)
        {
            PozadinaText.text = LanguageManager.LoadingTip3;
            PozadinaText.GetComponent <TextMeshEffects>().RefreshTextOutline(true, true, false);
            GameObject Background = Instantiate(Resources.Load("LoadingBackground/BgP3")) as GameObject;
            Background.transform.parent = GameObject.Find("Loading Tip BG").transform;
            RandomBroj = 3;
        }

        else
        {
            PozadinaText.text = StagesParser.LoadingPoruke[RandomBroj - 1];
            PozadinaText.GetComponent <TextMeshEffects>().RefreshTextOutline(true, true, false);
            StagesParser.LoadingPoruke.RemoveAt(RandomBroj - 1);

            GameObject Background = Instantiate(Resources.Load("LoadingBackground/BgP" + StagesParser.RedniBrojSlike[RandomBroj - 1].ToString())) as GameObject;
            StagesParser.RedniBrojSlike.RemoveAt(RandomBroj - 1);
            Background.transform.parent = GameObject.Find("Loading Tip BG").transform;
        }

        //TextMeshExtensions.AdjustFontSize(PozadinaText,true,true);
        if (PlaySounds.BackgroundMusic_Menu.isPlaying)
        {
            PlaySounds.Stop_BackgroundMusic_Menu();
        }
        if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
        {
            PlaySounds.Stop_BackgroundMusic_Gameplay();
        }
        StartCoroutine(LoadNextLevel());
    }
コード例 #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) && goScreen.activeSelf)
        {
            Time.timeScale             = 1;
            goScreen.transform.parent  = transform;
            goScreen2.transform.parent = transform;
            goScreen.SetActive(false);
            goScreen2.SetActive(false);
            playerController.state = MonkeyController2D.State.running;
            PlaySounds.Play_Run();
        }

        if (Input.GetMouseButtonUp(0))       // || Input.GetKeyDown(KeyCode.Space))
        {
            releasedItem = RaycastFunction(Input.mousePosition);
            if (releasedItem == "GO screen")
            {
                Time.timeScale             = 1;
                goScreen.transform.parent  = transform;
                goScreen2.transform.parent = transform;
                goScreen.SetActive(false);
                goScreen2.SetActive(false);
                playerController.state = MonkeyController2D.State.running;
                GameObject.Find("PrinceGorilla").GetComponent <Animator>().SetBool("Run", true);               //MOZDA DA SE VRATI U PrinceGorilla
                PlaySounds.Play_Run();
                StartCoroutine(showPickPowers());
            }
            else if (releasedItem == "ButtonPause")
            {
                PlaySounds.Play_Button_Pause();
                //playerController.state = MonkeyController2D.State.idle;
                //pauseButton.GetChild(0).animation.Play();
                pauseScreenHolder.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, pauseScreenHolder.transform.position.z);
                pauseScreenHolder.SetActive(true);

                if (Time.timeScale == 1)
                {
                    Time.timeScale = 0;
                    StopAllCoroutines();
                    StartCoroutine(showPauseScreen());
                }
                else
                {
                    StartCoroutine(dropPauseScreen());
                }
            }
            else if (releasedItem == "PauseHoleMain")            // KLIKNUTO NA MAIN DUGME IZ PAUSE MENIJA
            {
                PlaySounds.Play_Button_GoBack();
                StartCoroutine(backToMenu());
            }

            else if (releasedItem == "PauseHolePlay")            // KLIKNUTO NA PLAY DUGME IZ PAUSE MENIJA
            {
                PlaySounds.Play_Button_Pause();
                StartCoroutine(unPause());
                if (playerStopiran)
                {
                    playerController.heCanJump = true;
                    buttonShopBack.GetChild(0).GetComponent <Animation>().Play("BackButtonClick");
                    StartCoroutine(closeShop());
                    playerStopiran = false;
                    GameObject.Find("ButtonPause").GetComponent <Collider>().enabled       = true;
                    GameObject.Find("OBLACI").GetComponent <RunWithSpeed>().continueMoving = true;
                    playerController.GetComponent <Rigidbody2D>().isKinematic = false;
                    playerController.animator.enabled = true;
                    playerController.maxSpeedX        = playerController.startSpeedX;
                    cameraFollow.cameraFollowX        = true;
                    //cameraFollow.cameraFollowY = false;
                    //cameraFollow.moveUp = true;
                    //cameraFollow.moveDown = false;
                }
            }

            else if (releasedItem == "PauseHoleRestart")            // KLIKNUTO NA RESTART DUGME IZ PAUSE MENIJA
            {
                PlaySounds.Play_Button_RestartLevel();
                StartCoroutine(restartLevel());
            }

            else if (releasedItem == "FailedMainHole")            // KLIKNUTO NA MAIN DUGME IZ FAILED MENIJA
            {
                PlaySounds.Play_Button_GoBack();
                GameObject temp = GameObject.Find("ButtonMain_Failed");
                temp.GetComponent <Animation>().Play("FinishButtonsClick");
                if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
                {
                    PlaySounds.Stop_BackgroundMusic_Gameplay();
                }
                //nivoManager.currentLevel = 0;
                command = delegate { Application.LoadLevel(4); };
                StartCoroutine(FailedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FailedGo", false, what => { helpBool = true; }));
                StartCoroutine(DoAfterAnimation(temp, "FinishButtonsClick"));
            }

            else if (releasedItem == "FailedRestartHole")            // KLIKNUTO NA RESTART DUGME IZ FAILED MENIJA
            {
                PlaySounds.Play_Button_RestartLevel();
                GameObject temp = GameObject.Find("ButtonRestart_Failed");
                temp.GetComponent <Animation>().Play("FinishButtonsClick");
                command = delegate { Application.LoadLevel(Application.loadedLevel); };
                StartCoroutine(FailedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FailedGo", false, what => { helpBool = true; }));
                StartCoroutine(DoAfterAnimation(temp, "FinishButtonsClick"));
            }

            else if (releasedItem == "ButtonRestart1")            // KLIKNUTO NA RESTART DUGME IZ FINISH MENIJA
            {
                PlaySounds.Play_Button_RestartLevel();
                GameObject temp = GameObject.Find("ButtonRestart1");
                temp.GetComponent <Animation>().Play("FinishButtonsClick");
                command = delegate { Application.LoadLevel(Application.loadedLevel); };
                StartCoroutine(Win_CompletedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FinishTableGo1", false, what => { helpBool = true; }));
                StartCoroutine(DoAfterAnimation(temp, "FinishButtonsClick"));
            }

            else if (releasedItem == "ButtonMain1")            // KLIKNUTO NA MAIN DUGME IZ FINISH MENIJA
            {
                PlaySounds.Play_Button_GoBack();
                GameObject temp = GameObject.Find("ButtonMain1");
                temp.GetComponent <Animation>().Play("FinishButtonsClick");
                if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
                {
                    PlaySounds.Stop_BackgroundMusic_Gameplay();
                }
                //nivoManager.currentLevel = 0;
                command = delegate { Application.LoadLevel(4); };
                StartCoroutine(Win_CompletedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FinishTableGo1", false, what => { helpBool = true; }));
                StartCoroutine(DoAfterAnimation(temp, "FinishButtonsClick"));
            }

            else if (releasedItem == "ButtonPlay1")            // KLIKNUTO NA PLAY DUGME IZ FINISH MENIJA
            {
                PlaySounds.Play_Button_NextLevel();
                GameObject temp = GameObject.Find("ButtonPlay1");
                temp.GetComponent <Animation>().Play("FinishButtonsClick");
                if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
                {
                    PlaySounds.Stop_BackgroundMusic_Gameplay();
                }
                //nivoManager.currentLevel = Application.loadedLevel;
                StagesParser.currStageIndex++;
                command = delegate { Application.LoadLevel("LoadingScene"); };
                StartCoroutine(Win_CompletedScreenHolder.transform.GetChild(0).GetComponent <Animation>().Play("FinishTableGo1", false, what => { helpBool = true; }));
                StartCoroutine(DoAfterAnimation(temp, "FinishButtonsClick"));
            }

            else if (releasedItem == "PauseHoleFreeCoins")            // KLIKNUTO NA FREE COINS IZ PAUSE MENIJA
            {
                playerStopiran             = true;
                playerController.heCanJump = false;
                GameObject.Find("ButtonPause").GetComponent <Collider>().enabled       = false;
                GameObject.Find("OBLACI").GetComponent <RunWithSpeed>().continueMoving = false;
                playerController.GetComponent <Rigidbody2D>().isKinematic = true;
                //playerController.state = MonkeyController2D.State.idle;
                playerController.maxSpeedX        = 0;
                playerController.animator.enabled = false;
                cameraFollow.cameraFollowX        = false;
                cameraFollow.cameraFollowY        = false;
                cameraFollow.moveUp   = false;
                cameraFollow.moveDown = false;
                Time.timeScale        = 1;
                StartCoroutine(OpenFreeCoinsCard());
            }

            else if (releasedItem == "PauseHoleShop")            // KLIKNUTO NA SHOP IZ PAUSE MENIJA
            {
                playerStopiran             = true;
                playerController.heCanJump = false;
                GameObject.Find("ButtonPause").GetComponent <Collider>().enabled       = false;
                GameObject.Find("OBLACI").GetComponent <RunWithSpeed>().continueMoving = false;
                playerController.GetComponent <Rigidbody2D>().isKinematic = true;
                //playerController.state = MonkeyController2D.State.idle;
                playerController.maxSpeedX        = 0;
                playerController.animator.enabled = false;
                cameraFollow.cameraFollowX        = false;
                cameraFollow.cameraFollowY        = false;
                cameraFollow.moveUp   = false;
                cameraFollow.moveDown = false;
                Time.timeScale        = 1;
                StartCoroutine(OpenFreeCoinsCard());
            }

            else if (releasedItem == "FinishKeyPrice")
            {
                StartCoroutine(BuyKeys());
            }
            else if (releasedItem == "ButtonFreeCoins1")            // KLIKNUTO NA FREE COINS IZ FINISH MENIJA
            {
                GameObject.Find(releasedItem).GetComponent <Animation>().Play("FinishButtonsClick");
                shopHolder.transform.position = Camera.main.transform.position + Vector3.forward * 5;
                StartCoroutine(OpenFreeCoinsCard());
            }
            else if (releasedItem == "ButtonShop1")            // KLIKNUTO NA SHOP IZ FINISH MENIJA
            {
                GameObject.Find(releasedItem).GetComponent <Animation>().Play("FinishButtonsClick");
                shopHolder.transform.position = Camera.main.transform.position + Vector3.forward * 5;
                StartCoroutine(OpenShopCard());
            }
            else if (releasedItem == "FailedFreeCoinsHole")            // KLIKNUTO NA FREE COINS IZ FAILED MENIJA
            {
                GameObject.Find(releasedItem).transform.GetChild(0).GetComponent <Animation>().Play("FinishButtonsClick");
                shopHolder.transform.position = Camera.main.transform.position + Vector3.forward * 5;
                StartCoroutine(OpenFreeCoinsCard());
            }
            else if (releasedItem == "FailedShopHole")            // KLIKNUTO NA SHOP IZ FAILED MENIJA
            {
                GameObject.Find(releasedItem).transform.GetChild(0).GetComponent <Animation>().Play("FinishButtonsClick");
                shopHolder.transform.position = Camera.main.transform.position + Vector3.forward * 5;
                StartCoroutine(OpenShopCard());
            }
            else if (releasedItem == "HolderBack")            // KLIKNUTO NA BACK IZ SHOP MENIJA
            {
                Debug.Log("ime: " + GameObject.Find(releasedItem));
                buttonShopBack.GetChild(0).GetComponent <Animation>().Play("BackButtonClick");
                StartCoroutine(closeShop());
            }
            else if (releasedItem == "ShopHeaderOff1")            // TREBA DA SE AKTIVIRA SHOP TAB
            {
                shopHeaderOff.SetActive(false);
                shopHeaderOn.SetActive(true);
                freeCoinsHeaderOn.SetActive(false);
                freeCoinsHeaderOff.SetActive(true);
                holderFreeCoinsCard.SetActive(false);
                holderShopCard.SetActive(true);
            }
            else if (releasedItem == "ShopHeaderOff")            // TREBA DA SE AKTIVIRA FREE COINS TAB
            {
                shopHeaderOn.SetActive(false);
                shopHeaderOff.SetActive(true);
                freeCoinsHeaderOff.SetActive(false);
                freeCoinsHeaderOn.SetActive(true);
                holderShopCard.SetActive(false);
                holderFreeCoinsCard.SetActive(true);
            }
            else if (releasedItem == "PowersCardCoinx2")
            {
                //GameObject temp = GameObject.Find(releasedItem);
                powerCard_CoinX2.GetComponent <Collider>().enabled = false;
                brojDoubleCoins--;
                powerCard_CoinX2.GetChild(3).GetChild(0).GetComponent <TextMesh>().text = brojDoubleCoins.ToString();
                powerCard_CoinX2.GetChild(3).GetChild(1).GetComponent <TextMesh>().text = brojDoubleCoins.ToString();
                kupljenDoubleCoins = true;
                powerCard_CoinX2.GetComponent <Animator>().Play("GameplayPowerClick2");
                ApplyPowerUp(2);
            }
            else if (releasedItem == "PowersCardMagnet")
            {
                //GameObject temp = GameObject.Find(releasedItem);
                powerCard_Magnet.GetComponent <Collider>().enabled = false;
                brojMagneta--;
                powerCard_Magnet.GetChild(3).GetChild(0).GetComponent <TextMesh>().text = brojMagneta.ToString();
                powerCard_Magnet.GetChild(3).GetChild(1).GetComponent <TextMesh>().text = brojMagneta.ToString();
                kupljenMagnet = true;
                powerCard_Magnet.GetComponent <Animator>().Play("GameplayPowerClick2");
                ApplyPowerUp(1);
            }
            else if (releasedItem == "PowersCardShield")
            {
                //GameObject temp = GameObject.Find(releasedItem);
                powerCard_Shield.GetComponent <Collider>().enabled = false;
                brojShieldova--;
                powerCard_Shield.GetChild(3).GetChild(0).GetComponent <TextMesh>().text = brojShieldova.ToString();
                powerCard_Shield.GetChild(3).GetChild(1).GetComponent <TextMesh>().text = brojShieldova.ToString();
                kupljenShield = true;
                powerCard_Shield.GetComponent <Animator>().Play("GameplayPowerClick2");
                ApplyPowerUp(3);
            }
        }
    }
コード例 #4
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (PlaySounds.soundOn)
            {
                PlaySounds.Play_Button_OpenLevel();
            }
            Application.LoadLevel(1);
        }
        else if (Input.GetMouseButtonDown(0))
        {
            clickedItem = RaycastFunction(Input.mousePosition);
            if (clickedItem.Equals("Button_Back") || clickedItem.Equals("Button_Subscribe"))
            {
                temp                      = GameObject.Find(clickedItem);
                originalScale             = temp.transform.localScale;
                temp.transform.localScale = originalScale * 0.8f;
            }
        }

        else if (Input.GetMouseButtonUp(0))
        {
            releasedItem = RaycastFunction(Input.mousePosition);
            if (!clickedItem.Equals(System.String.Empty))
            {
                if (temp != null)
                {
                    temp.transform.localScale = originalScale;
                }

                if (releasedItem.Equals("Button_Back"))
                {
                    if (PlaySounds.BackgroundMusic_Gameplay.isPlaying)
                    {
                        PlaySounds.Stop_BackgroundMusic_Gameplay();
                    }
                    if (PlaySounds.soundOn)
                    {
                        PlaySounds.Play_Button_OpenLevel();
                    }
                    Application.LoadLevel(1);
                }
//				else if(clickedItem.Equals("Button_Subscribe"))
//				{
//					keyboard = TouchScreenKeyboard.Open(mail,TouchScreenKeyboardType.ASCIICapable,false,true,false,false, "Enter Term");
//				}
                else if (clickedItem.Equals("Button_Subscribe"))
                {
                    if (PlaySounds.soundOn)
                    {
                        PlaySounds.Play_Button_OpenLevel();
                    }
                    //keyboard = TouchScreenKeyboard.Open(mail,TouchScreenKeyboardType.ASCIICapable,false,true,false,false, "Enter Your Email Here");
                    PlayerPrefs.SetInt("MailSent", 1);
                    PlayerPrefs.Save();
                    GameObject.Find("Button_Subscribe").SetActive(false);
                }
            }
        }


        if (keyboard != null)
        {
            if (keyboard.done)
            {
                mail     = keyboard.text;
                keyboard = null;
                if (!mail.Equals(System.String.Empty) && mail.Contains("@"))
                {
                    Debug.Log("poruka: " + mail);
                    if (invalidMail.activeSelf)
                    {
                        invalidMail.SetActive(false);
                    }
                    GameObject.Find("Button_Subscribe").SetActive(false);
                    //StartCoroutine("postToServer");
                }
                else
                {
                    Debug.Log("treba da je prazno: " + mail);
                    invalidMail.SetActive(true);
                }
            }
        }
    }