Exemplo n.º 1
0
    // show word from collection with desired index
    public void ShowScramble(int index)
    {
        charObjects.Clear();
        foreach (Transform child in container)
        {
            Destroy(child.gameObject);
        }

        if (index > words.Length - 1)
        {
            gameDone();
            return;
        }

        char[] chars = words[index].GetString().ToCharArray();
        foreach (char c in chars)
        {
            CharObject1 clone = Instantiate(prefab.gameObject).GetComponent <CharObject1>();
            clone.transform.SetParent(container);

            charObjects.Add(clone.Init(c));
        }

        currentWord = index;
        StartCoroutine(TimeLeft());
    }
Exemplo n.º 2
0
    public void SwapCharObject(int indexA, int indexB)
    {
        CharObject1 tmpA = charObjects[indexA];

        charObjects[indexA] = charObjects[indexB];

        charObjects[indexB] = tmpA;

        charObjects[indexA].transform.SetAsLastSibling();
        //top one, if setAsFirstSibling means bottom one
        charObjects[indexB].transform.SetAsLastSibling();

        CheckWord();
    }
Exemplo n.º 3
0
    public void Select(CharObject1 charObject)
    {
        if (firstSelected)
        {
            SwapCharObject(firstSelected.charIndex, charObject.charIndex);

            firstSelected.Select();
            charObject.Select();
        }

        else
        {
            firstSelected = charObject;
        }
    }
Exemplo n.º 4
0
 public void UnSelect()
 {
     firstSelected = null;
 }