Beispiel #1
0
    List <Letter> CreateLetterList(List <char> arr) //Instantiate letter prefabs and add their scripts to collection
    {
        List <Letter> letterList = new List <Letter>();

        foreach (char item in arr)
        {
            GameObject go = Instantiate(letterPrefab.gameObject, lettersBoard);
            go.GetComponent <Image>().color = levelColor;
            string letter = item.ToString().ToUpper();
            Letter script = go.GetComponent <Letter>();
            script.textField.text = letter;
            script.Clicked       += x => StaticBehaviors.LetterClick(x, letterFieldsList);
            letterList.Add(script);
        }
        return(letterList);
    }