示例#1
0
    // Use this for initialization

    void Start()
    {
        //Maybe change the path
        //string fileName = "Assets/Luc/Resources/demi_liste_francais_utf8.txt";
        string fileName = Application.dataPath + "/demi_liste_francais_utf8.txt";

        List <string> lines  = new List <string> ();
        StreamReader  reader = File.OpenText(fileName);

        while (!reader.EndOfStream)
        {
            lines.Add(reader.ReadLine());
        }
        reader.Close();

        // Seed a random number in the range 0 to lines length
        int randomNumber = Random.Range(0, lines.Count);

        // Read the random line
        line = lines [randomNumber];

        hasFocus    = false;
        myText      = GetComponentInChildren <TextMesh> ();
        scroll      = GameObject.FindObjectOfType <Autoscroller> ();
        myText.text = line;
        workingText = new string[myText.text.Length];
        for (int i = 0; i < myText.text.Length; i++)
        {
            workingText [i] = myText.text.ToCharArray() [i].ToString();
        }
        counter    = 0;
        spawning   = false;
        EndColor   = plateforme.GetComponent <Renderer> ().material.color;
        EndColor.a = 1;
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     scroller = GameObject.FindObjectsOfType <Autoscroller> () [0];
     anim     = GetComponentInChildren <Animator> ();
     affPdv   = GetComponentInChildren <TextMesh> ();
     setAffPdv();
     oneJump = true;
 }