Ejemplo n.º 1
0
    List <LetterField> CreateLetterFields(List <char> arr) //Instantiate letter fields and add their scripts to collection
    {
        List <LetterField> letterArr = new List <LetterField>();

        foreach (char item in arr)
        {
            GameObject go = Instantiate(letterFieldPrefab.gameObject, lettersFields);
            if (item != ' ')
            {
                LetterField _this = go.GetComponent <LetterField>();
                letterArr.Add(_this);
                if (DataManager.Instance.RemoveClearButtons)
                {
                    Button temp = go.AddComponent <Button>();
                    temp.transition = Selectable.Transition.None;
                    temp.onClick.AddListener(() => StaticBehaviors.Clear(_this));
                }
            }
            else
            {
                go.GetComponent <Image>().enabled = false;
            }
        }
        return(letterArr);
    }