Esempio n. 1
0
    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;
    }
Esempio n. 2
0
    public void TimeToLeave()
    {
        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();
        }

        waitingForDestruction = false;
        leftHome = true;
    }