public void LeaveHomeGoHome() { GameObject.Find("Screen Handlers").GetComponent <PurchaseCoinsScreenHandler> ().GetRidOfScreen(); if (buttonHandler.GetRestartFirstR() != null) { buttonHandler.GetRestartFirstR().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartE() != null) { buttonHandler.GetRestartE().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartS() != null) { buttonHandler.GetRestartS().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartFirstT() != null) { buttonHandler.GetRestartFirstT().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartA() != null) { buttonHandler.GetRestartA().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartSecondR() != null) { buttonHandler.GetRestartSecondR().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartSecondT() != null) { buttonHandler.GetRestartSecondT().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartConfirmationButton() != null) { buttonHandler.GetRestartConfirmationButton().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetRestartCancelButton() != null) { buttonHandler.GetRestartCancelButton().GetComponent <RestartWordHandler> ().GoHome(); waitingForDestruction = true; } if (waitingForDestruction) { return; } // if (tempPressedQuitButton != null && hit3 != null && hit3.gameObject.tag == "Quit Button") { if (buttonHandler.GetQuitQ() == null) { buttonHandler.SetQuitQ((GameObject)Instantiate(quitQ, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .01f), Quaternion.identity)); leftHome = false; } quitWordHandler = buttonHandler.GetQuitQ().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } if (buttonHandler.GetQuitU() == null) { buttonHandler.SetQuitU((GameObject)Instantiate(quitU, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .02f), Quaternion.identity)); leftHome = false; } quitWordHandler = buttonHandler.GetQuitU().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } if (buttonHandler.GetQuitI() == null) { buttonHandler.SetQuitI((GameObject)Instantiate(quitI, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .03f), Quaternion.identity)); leftHome = false; } quitWordHandler = buttonHandler.GetQuitI().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } if (buttonHandler.GetQuitT() == null) { buttonHandler.SetQuitT((GameObject)Instantiate(quitT, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .04f), Quaternion.identity)); leftHome = false; } quitWordHandler = buttonHandler.GetQuitT().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } if (buttonHandler.GetQuitConformationButton() == null) { buttonHandler.SetQuitConformationButton((GameObject)Instantiate(quitConformationButton, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .06f), Quaternion.identity)); } quitWordHandler = buttonHandler.GetQuitConformationButton().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } if (buttonHandler.GetQuitCancelButton() == null) { buttonHandler.SetQuitCancelButton((GameObject)Instantiate(quitCancelButton, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .05f), Quaternion.identity)); leftHome = false; } quitWordHandler = buttonHandler.GetQuitCancelButton().GetComponent <QuitWordHandler> (); if (!leftHome) { quitWordHandler.LeaveHome(); } else { quitWordHandler.GoHome(); } Destroy(tempPressedQuitButton); leftHome = !leftHome; }
private void CheckTouch3(Vector3 pos) { Vector3 wp = Camera.main.ScreenToWorldPoint(pos); Vector2 touchPos = new Vector2(wp.x, wp.y); hit3 = Physics2D.OverlapPoint(touchPos); // if (tempPressedRestartButton != null && hit3 != null && hit3.gameObject.tag == "Restart Button") { if (buttonHandler.GetQuitQ() != null) { buttonHandler.GetQuitQ().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetQuitU() != null) { buttonHandler.GetQuitU().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetQuitI() != null) { buttonHandler.GetQuitI().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetQuitT() != null) { buttonHandler.GetQuitT().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetQuitConformationButton() != null) { buttonHandler.GetQuitConformationButton().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (buttonHandler.GetQuitCancelButton() != null) { buttonHandler.GetQuitCancelButton().GetComponent <QuitWordHandler> ().GoHome(); waitingForDestruction = true; } if (waitingForDestruction) { return; } if (buttonHandler.GetRestartFirstR() == null) { buttonHandler.SetRestartFirstR((GameObject)Instantiate(restartFirstR, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .01f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartFirstR().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartE() == null) { buttonHandler.SetRestartE((GameObject)Instantiate(restartE, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .02f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartE().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartS() == null) { buttonHandler.SetRestartS((GameObject)Instantiate(restartS, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .03f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartS().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartFirstT() == null) { buttonHandler.SetRestartFirstT((GameObject)Instantiate(restartFirstT, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .04f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartFirstT().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartA() == null) { buttonHandler.SetRestartA((GameObject)Instantiate(restartA, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .05f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartA().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartSecondR() == null) { buttonHandler.SetRestartSecondR((GameObject)Instantiate(restartSecondR, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .06f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartSecondR().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartSecondT() == null) { buttonHandler.SetRestartSecondT((GameObject)Instantiate(restartSecondT, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .07f), Quaternion.identity)); } restartWordHandler = buttonHandler.GetRestartSecondT().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartConfirmationButton() == null) { buttonHandler.SetRestartConfirmationButton((GameObject)Instantiate(restartConfirmationButton, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .08f), Quaternion.identity)); leftHome = false; } restartWordHandler = buttonHandler.GetRestartConfirmationButton().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } if (buttonHandler.GetRestartCancelButton() == null) { buttonHandler.SetRestartCancelButton((GameObject)Instantiate(restartCancelButton, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + .09f), Quaternion.identity)); } restartWordHandler = buttonHandler.GetRestartCancelButton().GetComponent <RestartWordHandler> (); if (!leftHome) { restartWordHandler.LeaveHome(); } else { restartWordHandler.GoHome(); } Destroy(tempPressedRestartButton); leftHome = !leftHome; // } }
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); }
// Update is called once per frame void Update() { if (leaveHome) { if (gameObject.name == "Restart Second T(Clone)") { transform.Translate(new Vector3(0, ((startingY + firstYCoefficient) - transform.position.y), 0) * .2f); 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 == "Restart Second R(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.51f * 2)) - transform.position.y), 0) * .2f); 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 == "Restart A(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.47f * 3)) - transform.position.y), 0) * .2f); 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 == "Restart T(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.45f * 4)) - transform.position.y), 0) * .2f); 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 == "Restart S(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.44f * 5)) - transform.position.y), 0) * .2f); if (Mathf.Abs(((startingY + (.44f * 5)) - transform.position.y)) < .001) { leaveHome = false; } } else if (gameObject.name == "Restart E(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.425f * 6)) - transform.position.y), 0) * .2f); if (Mathf.Abs(((startingY + (.425f * 6)) - transform.position.y)) < .001) { leaveHome = false; } } else if (gameObject.name == "Restart Capital R(Clone)") { transform.Translate(new Vector3(0, ((startingY + (.42f * 7)) - transform.position.y), 0) * .2f); if (Mathf.Abs(((startingY + (.42f * 7)) - transform.position.y)) < .001) { leaveHome = false; } } else if (gameObject.name == "Restart Confirmation Button(Clone)") { transform.Translate(new Vector3((startingX + .5f) - transform.position.x, ((startingY + (.45f * 6.5f)) - transform.position.y), 0) * .2f); if (Mathf.Abs(((startingX + .5f) - transform.position.x)) < .001 && Mathf.Abs(((startingY + (.45f * 6.5f)) - transform.position.y)) < .001) { leaveHome = false; } } else if (gameObject.name == "Restart Cancel Button(Clone)") { transform.Translate(new Vector3((startingX + .5f) - transform.position.x, ((startingY + (.45f * 5f)) - transform.position.y), 0) * .2f); if (Mathf.Abs(((startingX + .5f) - transform.position.x)) < .001 && Mathf.Abs(((startingY + (.45f * 5f)) - transform.position.y)) < .001) { leaveHome = false; } } } else if (goHome) { transform.Translate(new Vector3(buttonHandler.GetRestartButton().transform.position.x - transform.position.x, (startingY - transform.position.y), 0) * .3f); if (Mathf.Abs(startingY - transform.position.y) < .1f) { if (gameObject.name == "Restart Capital R(Clone)") { buttonHandler.SetRestartFirstR(null); } else if (gameObject.name == "Restart E(Clone)") { buttonHandler.SetRestartE(null); } else if (gameObject.name == "Restart S(Clone)") { buttonHandler.SetRestartS(null); } else if (gameObject.name == "Restart First T(Clone)") { buttonHandler.SetRestartFirstT(null); } else if (gameObject.name == "Restart A(Clone)") { buttonHandler.SetRestartA(null); } else if (gameObject.name == "Restart Second R(Clone)") { buttonHandler.SetRestartSecondR(null); } else if (gameObject.name == "Restart Second T(Clone)") { buttonHandler.SetRestartSecondT(null); } else if (gameObject.name == "Restart Confirmation Button(Clone)") { buttonHandler.SetRestartConfirmationButton(null); } if (GameObject.Find("Play Button(Clone)").GetComponent <PlayButtonHandler> ().GetWaitingForQuitDestruction() && buttonHandler.GetRestartFirstR() == null && buttonHandler.GetRestartE() == null && buttonHandler.GetRestartS() == null && buttonHandler.GetRestartSecondT() == null && buttonHandler.GetRestartA() == null && buttonHandler.GetRestartSecondR() == null && buttonHandler.GetRestartSecondT() == null) { GameObject.Find("Play Button(Clone)").GetComponent <PlayButtonHandler> ().GoHome(); } if (GameObject.Find("Quit Button(Clone)").GetComponent <QuitButtonHandler> ().GetWaitingForDestruction() && buttonHandler.GetRestartFirstR() == null && buttonHandler.GetRestartE() == null && buttonHandler.GetRestartS() == null && buttonHandler.GetRestartSecondT() == null && buttonHandler.GetRestartA() == null && buttonHandler.GetRestartSecondR() == null && buttonHandler.GetRestartSecondT() == null) { GameObject.Find("Quit Button(Clone)").GetComponent <QuitButtonHandler> ().TimeToLeave(); } Destroy(gameObject); } } }
private void CheckTouch3(Vector3 pos) { Vector3 wp = Camera.main.ScreenToWorldPoint(pos); Vector2 touchPos = new Vector2(wp.x, wp.y); hit3 = Physics2D.OverlapPoint(touchPos); if (gameObject.name == "Quit Cancel Button(Clone)") { soundHandler.PlayButtonClickUp(); buttonHandler = GameObject.Find("Button Handler").GetComponent <ButtonHandler> (); 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.GetQuitCancelButton() != null) { buttonHandler.GetQuitCancelButton().GetComponent <QuitWordHandler> ().GoHome(); } if (buttonHandler.GetQuitConformationButton() != null) { buttonHandler.GetQuitConformationButton().GetComponent <QuitWordHandler> ().GoHome(); } } if (gameObject.name == "Restart Cancel Button(Clone)") { soundHandler.PlayButtonClickUp(); buttonHandler = GameObject.Find("Button Handler").GetComponent <ButtonHandler> (); 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.GetRestartCancelButton() != null) { buttonHandler.GetRestartCancelButton().GetComponent <RestartWordHandler> ().GoHome(); } if (buttonHandler.GetRestartConfirmationButton() != null) { buttonHandler.GetRestartConfirmationButton().GetComponent <RestartWordHandler> ().GoHome(); } } }