コード例 #1
0
ファイル: GMScript.cs プロジェクト: KobaltKoding/WordScramble
    public IEnumerator Check()//check if ans is correct
    {
        next.GetComponent <MeshRenderer>().enabled  = true;
        next.GetComponent <BoxCollider2D>().enabled = true;

        right       = options.word;
        imageSelect = GameObject.Find("Image").GetComponent <ImageSelect>();
        imageSelect.Disable(right);

        Debug.Log(right);
        Debug.Log(currentWord);
        Debug.Log("above ig");
        if (currentWord == right)
        {
            Debug.Log("enter if");
            result.GetChild(0).GetComponent <TextMesh>().text = "Congrats";
            FindObjectOfType <Score>().ScorePlus();
            FindObjectOfType <WordSelect>().Remove();
        }
        else
        {
            result.GetChild(0).GetComponent <TextMesh>().text = right;
            yield return(new WaitForSeconds(2));

            result.GetChild(0).GetComponent <TextMesh>().text = "Try Again";
        }

        currentWord = "";
    }
コード例 #2
0
        /// <summary>
        /// Calculate number of words to fit complete instruction bytecode.
        /// </summary>
        /// <returns>Number of words in instruction bytecode.</returns>
        public override uint GetWordCount()
        {
            uint wordCount = 0;

            wordCount += IdResultType.GetWordCount();
            wordCount += IdResult.GetWordCount();
            wordCount += ImageSelect.GetWordCount();
            wordCount += Payload.GetWordCount();
            return(wordCount);
        }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        Select();
        while (prevWord == word)
        {
            Select();
        }
        prevWord = word;

        string shuffled = Scrambled(word);

        while (shuffled == word)  //scramble again if scrambled is same as original
        {
            shuffled = Scrambled(word);
        }
        for (int i = 0; i < word.Length; i++)
        {
            options.GetChild(i).GetComponent <TextMesh>().text = shuffled[i].ToString(); //display scrambled options
        }
        imageSelect = GameObject.Find("Image").GetComponent <ImageSelect>();             //display respective image of word
        imageSelect.Enable(word);
    }
コード例 #4
0
 /// <summary>
 /// Write instruction operands into bytecode stream.
 /// </summary>
 /// <param name="writer">Bytecode writer.</param>
 public override void WriteOperands(WordWriter writer)
 {
     ImageSelect.Write(writer);
     Payload.Write(writer);
 }