Example #1
0
    public void ClearBlocks()
    {
        for (int i = 0; i < Row1.Count; i++)
        {
            if (Row1[i].childCount > 0)
            {
                Destroy(Row1[i].transform.GetChild(0).gameObject);
            }
        }
        for (int i = 0; i < Row2.Count; i++)
        {
            if (Row2[i].childCount > 0)
            {
                Destroy(Row2[i].transform.GetChild(0).gameObject);
            }
        }
        for (int i = 0; i < Row3.Count; i++)
        {
            if (Row3[i].childCount > 0)
            {
                Destroy(Row3[i].transform.GetChild(0).gameObject);
            }
        }

        var   fairy       = GameObject.Find("Fairy");
        Fairy fairyScript = fairy.GetComponent <Fairy>();

        var     subject       = GameObject.Find("Subject");
        Subject subjectScript = subject.GetComponent <Subject>();

        // reset Fairy animation
        fairyScript.NoAnimation();

        // reset subject animation
        subjectScript.NoAnimation();
    }
Example #2
0
    public void UpdateStage()
    {
        var   fairy       = GameObject.Find("Fairy");
        Fairy fairyScript = fairy.GetComponent <Fairy>();

        var     subject       = GameObject.Find("Subject");
        Subject subjectScript = subject.GetComponent <Subject>();

        var          soundManager       = GameObject.Find("SoundManager");
        SoundManager soundManagerScript = soundManager.GetComponent <SoundManager>();

        // reset Fairy animation
        fairyScript.NoAnimation();

        // reset subject animation
        subjectScript.NoAnimation();

        // currentWords = words that have been made


        // load current board
        // for 3 rows
        // Row 1
        char[] board1 = new char[8];
        for (int i = 0; i < 8; i++)
        {
            if (Row1[i].childCount > 0)
            {
                board1[i] = Row1[i].GetChild(0).gameObject.name[0];
            }
        }

        // Row 2
        char[] board2 = new char[8];
        for (int i = 0; i < 8; i++)
        {
            if (Row2[i].childCount > 0)
            {
                board2[i] = Row2[i].GetChild(0).gameObject.name[0];
            }
        }

        // Row 3
        char[] board3 = new char[8];
        for (int i = 0; i < 8; i++)
        {
            if (Row3[i].childCount > 0)
            {
                board3[i] = Row3[i].GetChild(0).gameObject.name[0];
            }
        }


        // for 3 rows
        // run the function
        Search(board1, dictionaryLookupsList);
        Search(board2, dictionaryLookupsList);
        Search(board3, dictionaryLookupsList);

        // for this string in Current Words, use this
        for (int i = 0; i < currentWords.Count; i++)
        {
            foreach (var lookup in dictionaryLookupsList)
            {
                if (currentWords[i] == lookup.Name)
                {
                    if (lookup.Subject)
                    {
                        subjectScript.Animation(lookup.AnimationClipParameter);
                        soundManagerScript.playSound(soundManagerScript.wordSoundList[lookup.AudioClipNumber]);
                    }
                    else
                    {
                        // print(currentWords[i]);
                        // print(lookup.AnimationClipParameter);
                        fairyScript.Animation(lookup.AnimationClipParameter);
                        soundManagerScript.playSound(soundManagerScript.wordSoundList[lookup.AudioClipNumber]);
                    }
                }
            }
        }

        // // //RULES ----------------
        currentWords.Clear();
    }