Exemple #1
0
    // Use this for initialization
    void Start()
    {
        var inputFileHandler = new InputFileHandler("Internationalen.txt");

        _songLengthSeconds = Song.length;
        print("Song length: " + _songLengthSeconds);

        _mappedInputs = inputFileHandler.MappingsDict;

        //World distance is used because the local distance is not changed when the songbook is resized.
        _rowDistance = (EndLine.transform.position.x - Cursor.transform.position.x);

        _totalDistance = _rowDistance / FourBeatDelta;
        print(_totalDistance);

        // (Average Velocity = Total Distance / Total Time)
        _cursorVelocity = _totalDistance / _songLengthSeconds;
        _cursorBody     = Cursor.GetComponent <Rigidbody2D>();

        //Create all the input arrows
        foreach (var item in _mappedInputs)
        {
            CreateArrow(item.Key, item.Value);
        }

        //Hide the reference arrow
        ReferenceArrow.gameObject.SetActive(false);

        //Play the song
        GetComponent <AudioSource>().PlayOneShot(Song);
    }
Exemple #2
0
 public LexicalFileHandler(string xml_file, string input_file_name)
 {
     this.xml_file  = xml_file;
     this.inputfile = input_file_name;
     Grammar        = new XMLParser(xml_file);
     parseFile      = new InputFileHandler(input_file_name);
     Grammar.parseAll();
 }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        var inputFileHandler = new InputFileHandler("Internationalen.txt");

        _songLengthSeconds = Song.length;
        _mappedInputs      = inputFileHandler.MappingsDict;

        //Save the cursors transform and start position for easier referencing
        _cursorTransform     = Cursor.transform;
        _cursorStartPosition = _cursorTransform.localPosition;

        //World distance is needed because the local distance is not changed when the songbook is resized.
        _rowWorldDistance          = EndLine.position.x - StartLine.position.x;
        _totalCursorTravelDistance = _rowWorldDistance * RowCount;

        // (Average Velocity = Total Distance / Total Time)
        CursorVelocity = (_totalCursorTravelDistance / _songLengthSeconds);

        //For Debugging
        Debug.Log("Song duration: " + _songLengthSeconds);
        Debug.Log("World Distance: " + _totalCursorTravelDistance);
        Debug.Log("Cursor speed: " + CursorVelocity);

        //Create all the input arrows
        foreach (var item in _mappedInputs)
        {
            CreateArrow(item.Key, item.Value);
        }

        //Hide the reference arrow
        ReferenceArrow.SetActive(false);

        //Save the time when script is started
        _startTime = Time.time;

        //Play the song
        GetComponent <AudioSource>().PlayOneShot(Song, Volume);
    }