Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (beat == (Mathf.Floor((float)audioPlayer.SongBeat()) + 1) && !added)
        {
            noteController.AddCurrentNote(type);
            added = true;
        }
        double until = audioPlayer.beatLerper.TimeFromBeat(beat) - audioPlayer.SongTime();

        if (until < 0)
        {
            //Debug.Log("Note destroying self");
            Destroy(gameObject);
            return;
        }

        //renderer.color = new Color(renderer.color.r, renderer.color.g, renderer.color.b, (float)(1.0 - until));

        transform.position = Vector2.Lerp(noteController.GetStartPos(type), noteController.GetEndPos(type), (float)(1 - until / noteController.note_time));
        if (!renderer.enabled && until <= noteController.note_time)
        {
            renderer.enabled = true;
        }
    }