示例#1
0
        // create all objects necessary for sound game
        // including sound blanks, letters, jars, and word object
        void LoadSoundGameWord(string word)
        {
            // get properties of current word in game
            WordProperties prop = WordProperties.GetWordProperties(word);

            string[] phonemes = prop.Phonemes();           // phonemes in word
            float    objScale = prop.ObjScale();           // scale of word object

            // create sound blanks that are scrambled
            BlankCreation.CreateScrambledBlanks(word, phonemes, "Circle", "MovableBlank", "SoundGame");

            // create word object
            WordCreation.CreateWord(word, phonemes, "TargetLetter", "SoundGame");
            CreateWordImage(word, objScale);

            // create jars that "hold" each letter
            CreateJars();

            // make letters black color
            GameObject[] tar = GameObject.FindGameObjectsWithTag("TargetLetter");
            foreach (GameObject go in tar)
            {
                go.GetComponent <SpriteRenderer> ().color = Color.black;
            }
        }
        //<summary>
        // create all objects necessary for sound game
        // including sound blanks, letters, jars, and word object
        //</summary>
        void LoadSoundGameWord(string word)
        {
            // get properties of current word in game
            WordProperties prop = WordProperties.GetWordProperties(word);

            if (prop != null)
            {
                // phonemes in word
                string[] phonemes = prop.Phonemes();
                // scale of word object
                float objScale = prop.ObjScale();
                // create sound blanks that are scrambled
                BlankCreation.CreateScrambledBlanks(word, phonemes, "Circle", "MovableBlank", "SoundGame");
                // create word object
                WordCreation.CreateWord(word, phonemes, "TargetLetter", "SoundGame");
                CreateWordImage(word, objScale);
                // create jars that "hold" each letter
            }
            else
            {
                Debug.LogWarning("Cannot find word properties");
            }
            CreateJars();
            // make letters black color
            GameObject[] tar = GameObject.FindGameObjectsWithTag(Constants.Tags.TAG_TARGET_LETTER);
            foreach (GameObject go in tar)
            {
                go.GetComponent <SpriteRenderer>().color = Color.black;
            }
        }
        // create all objects necessary for spelling game
        // including letters, blanks, and word object
        void LoadSpellingGameWord(string word)
        {
            // get properties of current word in game
            WordProperties prop = WordProperties.GetWordProperties(word);

            string[] phonemes = prop.Phonemes();           // phonemes in word
            float    objScale = prop.ObjScale();           // scale of object

            // create word with scrambled letters
            WordCreation.CreateScrambledWord(word, phonemes);

            // create blanks
            BlankCreation.CreateBlanks(word, phonemes, "Rectangle", "TargetBlank", "SpellingGame");

            // create word object
            CreateWordImage(word, objScale);
        }