示例#1
0
    public void SetCorrectButtonPopup(GameObject newPopup)
    {
        initButtons();

        // for each button, loop over all interations
        // for each data member, if it has popup_placeholder tag, then replace it with the reference.
        foreach (GameObject gameObj in buttons)
        {
            PopupButtonScript popup = gameObj.GetComponent <PopupButtonScript>();
            if (popup)
            {
                popup.SetPopup(newPopup);
            }
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        GameObject camObj = GameObject.Find("MainCamera");

        if (camObj)
        {
            PopupMgr ppm = camObj.GetComponent <PopupMgr>();
            if (ppm)
            {
                // setup the level2 popups initial state
                ppm.Level2Finish.SetActive(false);
                ppm.Level2Repeat.SetActive(false);
                ppm.Level2Start.SetActive(true);
                PopupButtonScript pbs = ppm.Level2Start.transform.Find("Button1").gameObject.GetComponent <PopupButtonScript>();

                Level2Extras l2x = GetComponent <Level2Extras>();
                if (l2x)
                {
                    //setup the extras as the objects as objects that can be operated on in the popup_level2start button's
                    //action list.  this will cause the setupLevel2 and raceStartup objects will be enabled on click
                    pbs.actions[0].data.obj = l2x.setupLevel2;
                    pbs.actions[1].data.obj = l2x.raceStartup;

                    response_ShowRaceResultsPopup rrp = l2x.LevelLogicObj.GetComponent <response_ShowRaceResultsPopup>();
                    if (rrp)
                    {
                        // connect the level2Finish and level2Repeat popups to the showraceResultspopup response on the
                        // levelLogicObj object.  This allows levelLogicObj to enable either the repeat or pass popup when
                        // necessary
                        rrp.player     = GameObject.Find("Player1");
                        rrp.gm         = GameObject.Find("Game").GetComponent <gameMgr>();
                        rrp.passPopup  = ppm.Level2Finish;
                        rrp.retryPopup = ppm.Level2Repeat;
                    }

                    Destroy(this);
                }
            }
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        GameObject go = GameObject.Find("MainCamera");

        if (go)
        {
            // connect the lose ends between prefab instances in _level3 with objects in _global (such as popupmanager)
            PopupMgr ppm = go.GetComponent <PopupMgr>();
            if (ppm)
            {
                ppm.Level3Finish.SetActive(false);
                ppm.Level3Repeat.SetActive(false);
                ppm.Level3Start.SetActive(true);
                PopupButtonScript pbs = ppm.Level3Start.transform.Find("Button1").gameObject.GetComponent <PopupButtonScript>();

                // connect the enable setup level 3 button to the actual gameobject
                Level3Extras l3x = GetComponent <Level3Extras>();
                if (l3x)
                {
                    pbs.actions[0].data.obj = l3x.setupLevel3;
                }

                // connect the pass popup to the response behavior that shows the popup when you get enough points
                GameObject llo = GameObject.Find("LevelLogicObj");
                if (llo != null)
                {
                    llo.GetComponent <response_ShowLevel3Results>().passPopup = ppm.Level3Finish;
                }

                // connect the repeat popup to the time script for when the game clock ticks to zero
                GameObject TimeObj = GameObject.Find("Time");
                if (TimeObj != null)
                {
                    TimeObj.GetComponent <TimeScript>().failPopup = ppm.Level3Repeat;
                }
            }
        }
    }