Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (leaveHome)
        {
            if (gameObject.name == "T(Clone)")
            {
                transform.Translate(new Vector3(0, ((startingY + firstYCoefficient) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingY + firstYCoefficient) - transform.position.y)) < .001)
                {
                    //					transform.position = new Vector3 (transform.position.x, startingY + firstYCoefficient, transform.position.z);
                    leaveHome = false;
                }
            }

            else if (gameObject.name == "I(Clone)")
            {
                transform.Translate(new Vector3(0, ((startingY + (.51f * 2)) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingY + (.51f * 2)) - transform.position.y)) < .001)
                {
                    //					transform.position = new Vector3 (transform.position.x, startingY + (.49f * 2), transform.position.z);
                    leaveHome = false;
                }
            }

            else if (gameObject.name == "U(Clone)")
            {
                transform.Translate(new Vector3(0, ((startingY + (.47f * 3)) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingY + (.47f * 3)) - transform.position.y)) < .001)
                {
                    //					transform.position = new Vector3 (transform.position.x, startingY + (.45f * 2), transform.position.z);
                    leaveHome = false;
                }
            }

            else if (gameObject.name == "Capital Q(Clone)")
            {
                transform.Translate(new Vector3(0, ((startingY + (.45f * 4)) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingY + (.45f * 4)) - transform.position.y)) < .001)
                {
//										transform.position = new Vector3 (transform.position.x, startingY + (.43f * 2), transform.position.z);
                    leaveHome = false;
                }
            }

            else if (gameObject.name == "Quit Confirmation Button(Clone)")
            {
                transform.Translate(new Vector3((startingX + .5f) - transform.position.x, ((startingY + (.45f * 4f)) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingX + .5f) - transform.position.x)) < .001 && Mathf.Abs(((startingY + (.45f * 4)) - transform.position.y)) < .001)
                {
                    leaveHome = false;
                }
            }

            else if (gameObject.name == "Quit Cancel Button(Clone)")
            {
                transform.Translate(new Vector3((startingX + .5f) - transform.position.x, ((startingY + (.45f * 2.5f)) - transform.position.y), 0) * .0003f * Screen.width);
                if (Mathf.Abs(((startingX + .5f) - transform.position.x)) < .001 && Mathf.Abs(((startingY + (.45f * 2.5f)) - transform.position.y)) < .001)
                {
                    leaveHome = false;
                }
            }
        }

        else if (goHome)
        {
            transform.Translate(new Vector3(buttonHandler.GetQuitButton().transform.position.x - transform.position.x, (startingY - transform.position.y), 0) * .0003f * Screen.width);
            if (Mathf.Abs(startingY - transform.position.y) < .1f)
            {
                if (gameObject.name == "Capital Q(Clone)")
                {
                    buttonHandler.SetQuitQ(null);
                }
                else if (gameObject.name == "U(Clone)")
                {
                    buttonHandler.SetQuitU(null);
                }
                else if (gameObject.name == "I(Clone)")
                {
                    buttonHandler.SetQuitI(null);
                }
                else if (gameObject.name == "T(Clone)")
                {
                    buttonHandler.SetQuitT(null);
                }
                else if (gameObject.name == "Quit Confirmation Button(Clone)")
                {
                    buttonHandler.SetQuitConformationButton(null);
                }
                if (GameObject.Find("Play Button(Clone)").GetComponent <PlayButtonHandler> ().GetWaitingForQuitDestruction() && buttonHandler.GetQuitQ() == null && buttonHandler.GetQuitU() == null &&
                    buttonHandler.GetQuitI() == null && buttonHandler.GetQuitT() == null)
                {
                    GameObject.Find("Play Button(Clone)").GetComponent <PlayButtonHandler> ().GoHome();
                }
//				if (GameObject.Find ("Restart Button(Clone)").GetComponent<RestartButtonHandler> ().GetWaitingForDestruction () && buttonHandler.GetQuitQ () == null && buttonHandler.GetQuitU () == null &&
//				    buttonHandler.GetQuitI () == null && buttonHandler.GetQuitT () == null)
//					GameObject.Find ("Restart Button(Clone)").GetComponent<RestartButtonHandler> ().TimeToLeave ();
                Destroy(gameObject);
            }
        }
    }
    public void GoHome()
    {
        if (tempPressedPauseButton != null)
        {
            Destroy(tempPressedPauseButton);
        }
        if (buttonHandler.GetD() != null)
        {
            pausedWordHandler = buttonHandler.GetD().GetComponent <PausedWordHandler> ();
            buttonHandler.GetD().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetE() != null)
        {
            pausedWordHandler = buttonHandler.GetE().GetComponent <PausedWordHandler> ();
            buttonHandler.GetE().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetS() != null)
        {
            pausedWordHandler = buttonHandler.GetS().GetComponent <PausedWordHandler> ();
            buttonHandler.GetS().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetU() != null)
        {
            pausedWordHandler = buttonHandler.GetU().GetComponent <PausedWordHandler> ();
            buttonHandler.GetU().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetA() != null)
        {
            pausedWordHandler = buttonHandler.GetA().GetComponent <PausedWordHandler> ();
            buttonHandler.GetA().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetP() != null)
        {
            pausedWordHandler = buttonHandler.GetP().GetComponent <PausedWordHandler> ();
            buttonHandler.GetP().transform.parent = gameObject.transform;
            pausedWordHandler.GoHome();
        }

        if (buttonHandler.GetSoundButton() != null)
        {
            buttonHandler.GetSoundButton().transform.Translate(0, 0, 88);
            buttonHandler.GetSoundButton().GetComponent <SoundButtonHandler> ().ReturnHome();
        }

        if (buttonHandler.GetMusicButton() != null)
        {
            buttonHandler.GetMusicButton().transform.Translate(0, 0, 88);
            buttonHandler.GetMusicButton().GetComponent <MusicButtonHandler> ().ReturnHome();
        }

//		if (buttonHandler.GetRestartButton () != null) {
//			buttonHandler.GetRestartButton ().transform.Translate (0, 0, 88);
//			buttonHandler.GetRestartButton ().GetComponent<RestartButtonHandler> ().ReturnHome ();
//		}

        if (buttonHandler.GetQuitButton() != null)
        {
            buttonHandler.GetQuitButton().transform.Translate(0, 0, 88);
            buttonHandler.GetQuitButton().GetComponent <QuitButtonHandler> ().ReturnHome();
        }

        if (buttonHandler.GetBuyCoinsButton() != null)
        {
            buttonHandler.GetBuyCoinsButton().transform.Translate(0, 0, 88);
            buttonHandler.GetBuyCoinsButton().GetComponent <BuyCoinsButtonHandler> ().ReturnHome();
        }
    }
Exemplo n.º 3
0
    public void GoHome()
    {
        if (GameObject.Find("Quit Button(Clone)") != null)
        {
            GameObject.Find("Quit Button(Clone)").GetComponent <QuitButtonHandler> ().DestroyTempPressedButton();
        }
        if (GameObject.Find("Sound Off Button(Clone)") != null)
        {
            GameObject.Find("Sound Off Button(Clone)").GetComponent <SoundButtonHandler> ().DestroyTempPressedButton();
        }
        if (GameObject.Find("Music Off Button(Clone)") != null)
        {
            GameObject.Find("Music Off Button(Clone)").GetComponent <MusicButtonHandler> ().DestroyTempPressedButton();
        }
        if (GameObject.Find("Sound On Button(Clone)") != null)
        {
            GameObject.Find("Sound On Button(Clone)").GetComponent <SoundButtonHandler> ().DestroyTempPressedButton();
        }
        if (GameObject.Find("Music On Button(Clone)") != null)
        {
            GameObject.Find("Music On Button(Clone)").GetComponent <MusicButtonHandler> ().DestroyTempPressedButton();
        }

        if (buttonHandler.GetRestartFirstR() != null)
        {
            buttonHandler.GetRestartFirstR().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartE() != null)
        {
            buttonHandler.GetRestartE().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartS() != null)
        {
            buttonHandler.GetRestartS().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartFirstT() != null)
        {
            buttonHandler.GetRestartFirstT().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartA() != null)
        {
            buttonHandler.GetRestartA().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartSecondR() != null)
        {
            buttonHandler.GetRestartSecondR().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartSecondT() != null)
        {
            buttonHandler.GetRestartSecondT().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartConfirmationButton() != null)
        {
            buttonHandler.GetRestartConfirmationButton().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetRestartCancelButton() != null)
        {
            buttonHandler.GetRestartCancelButton().GetComponent <RestartWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitQ() != null)
        {
            buttonHandler.GetQuitQ().GetComponent <QuitWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitU() != null)
        {
            buttonHandler.GetQuitU().GetComponent <QuitWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitI() != null)
        {
            buttonHandler.GetQuitI().GetComponent <QuitWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitT() != null)
        {
            buttonHandler.GetQuitT().GetComponent <QuitWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitConformationButton() != null)
        {
            buttonHandler.GetQuitConformationButton().GetComponent <QuitWordHandler> ().GoHome();
        }

        if (buttonHandler.GetQuitCancelButton() != null)
        {
            buttonHandler.GetQuitCancelButton().GetComponent <QuitWordHandler> ().GoHome();
        }
        if (buttonHandler.GetQuitCancelButton() != null || buttonHandler.GetQuitConformationButton() != null || buttonHandler.GetQuitQ() != null || buttonHandler.GetQuitU() != null || buttonHandler.GetQuitI() != null || buttonHandler.GetQuitT() != null ||
            buttonHandler.GetRestartCancelButton() != null || buttonHandler.GetRestartConfirmationButton() != null ||
            buttonHandler.GetRestartFirstR() != null || buttonHandler.GetRestartE() != null || buttonHandler.GetRestartS() != null ||
            buttonHandler.GetRestartFirstT() != null || buttonHandler.GetRestartA() != null || buttonHandler.GetRestartSecondR() != null || buttonHandler.GetRestartSecondT() != null)
        {
            waitingForQuitDestruction = true;
            return;
        }

        instantiatedPausedShade = GameObject.Find("Paused Shade(Clone)");
        if (instantiatedPausedShade == null)
        {
            instantiatedPausedShade = (GameObject)Instantiate(pausedSlide);
        }
        shadeHandler = instantiatedPausedShade.GetComponent <PausedShadeHandler> ();
        shadeHandler.MakeInvisible();
        if (buttonHandler.GetP() != null)
        {
            buttonHandler.GetP().GetComponent <PausedWordHandler> ().GoHome();
        }
        if (buttonHandler.GetA() != null)
        {
            buttonHandler.GetA().GetComponent <PausedWordHandler> ().GoHome();
        }
        if (buttonHandler.GetU() != null)
        {
            buttonHandler.GetU().GetComponent <PausedWordHandler> ().GoHome();
        }
        if (buttonHandler.GetS() != null)
        {
            buttonHandler.GetS().GetComponent <PausedWordHandler> ().GoHome();
        }
        if (buttonHandler.GetE() != null)
        {
            buttonHandler.GetE().GetComponent <PausedWordHandler> ().GoHome();
        }
        if (buttonHandler.GetD() != null)
        {
            buttonHandler.GetD().GetComponent <PausedWordHandler> ().GoHome();
        }

        if (buttonHandler.GetMusicButton() != null)
        {
            musicButtonHandler = buttonHandler.GetMusicButton().GetComponent <MusicButtonHandler> ();
            musicButtonHandler.ReturnHome();
        }

        if (buttonHandler.GetSoundButton() != null)
        {
            soundButtonHandler = buttonHandler.GetSoundButton().GetComponent <SoundButtonHandler> ();
            soundButtonHandler.ReturnHome();
        }

//			restartButtonHandler = buttonHandler.GetRestartButton ().GetComponent<RestartButtonHandler> ();
//			restartButtonHandler.ReturnHome ();
        if (buttonHandler.GetQuitButton() != null)
        {
            quitButtonHandler = buttonHandler.GetQuitButton().GetComponent <QuitButtonHandler> ();
            quitButtonHandler.ReturnHome();
        }

        if (buttonHandler.GetBuyCoinsButton() != null)
        {
            buyCoinsButtonHandler = buttonHandler.GetBuyCoinsButton().GetComponent <BuyCoinsButtonHandler> ();
            buyCoinsButtonHandler.ReturnHome();
        }

        touchHandler.UnpauseTouch();
        Time.timeScale = 1;
        GameObject instantiatedPauseButton = (GameObject)Instantiate(pauseButton, gameObject.transform.position, Quaternion.identity);

        if (instantiateShade)
        {
            instantiatedPauseButton.GetComponent <PauseButtonHandler> ().SetTouchOn(false);
            instantiatedPauseButton.GetComponent <PauseButtonHandler> ().InstantiateShade();
        }
        if (tempPressedPlayButton != null)
        {
            Destroy(tempPressedPlayButton);
        }
        Destroy(gameObject);
    }