Ejemplo n.º 1
0
    public void SpawnGold(int i)
    {
        GameObject NewItem;
        Vector2    Positie = new Vector2(Positions2[Random.Range(0, Positions2.Count)], Random.Range(250, -100));

        Positions2.Remove(Positie.x);
        NewItem = Instantiate(GoldBlock, Positie, GoldBlock.transform.rotation);



        NewItem.GetComponent <Image>().sprite = VisualBlock[Random.Range(0, VisualBlock.Length)];
        if ((trueWords == null) || (!trueWords.Any()))
        {
            if (Starting == true)
            {
                NewItem.GetComponentInChildren <Text>().text = SentenceMissingParts.Sentence.falseWords[Random.Range(0, SentenceMissingParts.Sentence.falseWords.Length)];
            }
            else if (Starting == false)
            {
                NewItem.GetComponentInChildren <Text>().text = SentenceMissingParts.Sentence.Words[Random.Range(0, SentenceMissingParts.Sentence.Words.Length)].Justwords[0];
            }
        }
        else
        {
            NewItem.GetComponentInChildren <Text>().text = trueWords[0];
            trueWords.Remove(NewItem.GetComponentInChildren <Text>().text);
        }
        NewItem.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false);
    }
Ejemplo n.º 2
0
    void InstantiateObjects(GameObject Item, int i)
    {
        GameObject NewItem;
        int        PosX    = 250 * i;
        Vector2    Positie = new Vector2(Kart.GetComponent <RectTransform>().localPosition.x + PosX, Kart.GetComponent <RectTransform>().transform.localPosition.y);

        NewItem = Instantiate(Item, Positie, Kart.GetComponent <RectTransform>().transform.rotation);
        if (NewItem.GetComponentInChildren <Text>() != null)
        {
            NewItem.GetComponentInChildren <KartScript>().Word = Sentence.Words[i];

            if (EmptyWord == i)
            {
                NewItem.GetComponentInChildren <Text>().text = "...";
                Sentence.Words[i].Disappear = true;
            }
            else
            {
                NewItem.GetComponentInChildren <Text>().text = Sentence.Words[i].Word;
            }
        }

        NewItem.transform.SetParent(GameObject.FindGameObjectWithTag("Kart").transform, false);
    }