Game Development Reference
In-Depth Information
10. Now that we have PopupButtonScript , we assign a reference to the
Level3Extras script (attached to this object) to the data field of the first
action of PopupButtonScript . This way, when the button is clicked, the
EnableObject action will operate on the SetupLevel3 GameObject (ac-
cessed from Level3Extras ):
Level3Extras l3x =
GetComponent<Level3Extras>();
if (l3x)
{
pbs.actions[0].data.obj =
l3x.setupLevel3;
}
11. Next, we connect the popup_Level3Finish pop up to the re-
sponse_ShowLevel3Results component. This will allow LevelLo-
gicObj to display the level complete UI:
GameObject llo = GameObject.Find
("LevelLogicObj");
if (llo != null)
{
llo.GetComponent<response_ShowLevel3Results>().passPopup
= ppm.Level3Finish;
}
12. In _level3 , the fail condition is triggered from the Timer GameObject,
when the time remaining reaches zero. To enable this component to display
the popup_Level3Repeat UI, we must connect them together via the
PopupMgr script:
GameObject TimeObj = GameObject.Find
("Time");
if (TimeObj != null)
{
TimeObj.GetComponent<TimeScript>().failPopup
Search WWH ::




Custom Search