Example #1
0
    public IEnumerator waitForFormLoad(LEM_FormController lem, LEM_BottomController lbm, LevelData LED)
    {
        while (lem.Init == false)
        {
            yield return(new WaitForSeconds(0.5f));
        }

        lem.xpos = LED.x;
        lem.ypos = LED.y;

        lbm.xpos = LED.xinbottom;
        lbm.ypos = LED.yinbottom;

        while (lem.FormBuild.Rotated != LED.RotationState)
        {
            lem.FormBuild.RotateRight();
            lbm.FormBuild.RotateRight();
        }

        lem.GenerateImages();
        lem.ChangeColor(LED.Color);
        lem.UpdatePosition();

        lbm.GenerateImages();
        lbm.ChangeColor(LED.Color);
        lbm.UpdatePosition();
        lem.LBM   = lbm;
        lbm.LEMFC = lem;
    }
Example #2
0
    public LEM_FormController SpawnForm(string Name = "")
    {
        LEM_FormController c = null;

        if (Name == "")
        {
            Name = FormList.options[FormList.value].text;
        }

        List <Form> forms = MISC.LoadForms();

        for (int x = 0; x < forms.Count; x++)
        {
            if (forms[x].Name == Name)
            {
                GameObject Cache = Instantiate(FormFrame);
                Cache.transform.SetParent(FormContainer.transform);
                Cache.name = "Form";

                LEM_FormController LEMFC = Cache.GetComponent <LEM_FormController>();
                if (LEMFC != null)
                {
                    LEMFC.FormPlan = forms[x];
                    RectTransform LEMFCRT = Cache.GetComponent <RectTransform>();
                    LEMFCRT.anchoredPosition = Vector2.zero;
                    LEMFCRT.anchorMin        = new Vector2(0, 1);
                    LEMFCRT.anchorMax        = new Vector2(0, 1);
                    LEMFCRT.pivot            = new Vector2(0, 1);
                    // return LEMFC;
                }
                else
                {
                    Debug.LogError("[LEM] No Form Controller found!");
                }


                Cache = Instantiate(FormButtonFrame);
                Cache.transform.SetParent(FormButtonContainer.transform);
                Cache.name = "BottomForm";

                LEM_BottomController LEMBC = Cache.GetComponent <LEM_BottomController>();
                if (LEMBC != null)
                {
                    LEMBC.FormPlan = forms[x];
                    RectTransform LEMFCRT = Cache.GetComponent <RectTransform>();
                    LEMFCRT.anchoredPosition = Vector2.zero;
                    LEMFCRT.anchorMin        = new Vector2(0, 1);
                    LEMFCRT.anchorMax        = new Vector2(0, 1);
                    LEMFCRT.pivot            = new Vector2(0, 1);
                    CurrentBottom            = LEMBC;
                    return(LEMFC);
                }
                else
                {
                    Debug.LogError("[LEM] No Form Controller found!");
                }

                return(c);
            }
        }

        Debug.LogWarning("[LEM] Could not find form!");
        return(c);
    }