Exemple #1
0
        //
        /// <summary>
        /// Update
        /// </summary>
        public void Update()
        {
            //! @code
            //! midiFilePlayer.MPTK_PlayNote(note);
            //! FirstNotePlayed = true;
            //! @endcode
            if (!played && transform.position.x < -45f)
            {
                played = true;
                // If original z is not the same, the value will be changed, too bad for the ears ...
                int delta = Mathf.CeilToInt(zOriginal - transform.position.z + 0.5f);
                //! [Example PlayNote]
                note.Value += delta;
                // Now play the note
                midiStreamPlayer.MPTK_PlayEvent(note);
                //! [Example PlayNote]
                FirstNotePlayed = true;

                gameObject.GetComponent <Renderer>().material = MatPlayed;// .color = Color.red;
            }
            if (transform.position.y < -30f)
            {
                Destroy(this.gameObject);
            }
        }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     if (!played && transform.position.y < 1f)
     {
         played = true;
         midiStreamPlayer.MPTK_PlayEvent(note);
         FirstNotePlayed = true;
     }
 }
Exemple #3
0
 private void OnTriggerEnter(Collider other)
 {
     //xSpeed = 0;
     //ySpeed = 0;
     //zSpeed = 0;
     TrailParticleSystem.Stop();
     if (!autoPlay)
     {
         pressable = true;
         StartCoroutine(DestoryAfterParticle(CollisionParticleSystem.main.startLifetimeMultiplier - 0.02f));
         Debug.Log($"Coroutine started: {Time.time}");
     }
     else
     {
         streamPlayer.MPTK_PlayEvent(note);
         Destroy(gameObject);
     }
 }
Exemple #4
0
        void Update()
        {
            if (!played && transform.position.x < -45f)
            {
                played = true;
                // If original z is not the same, the value will be changed, too bad for the ears ...
                int delta = Mathf.CeilToInt(zOriginal - transform.position.z + 0.5f);
                note.Value += delta;
                // Now play the note (control change here)
                midiStreamPlayer.MPTK_PlayEvent(note);

                gameObject.GetComponent <Renderer>().material = MatPlayed;
            }
            if (transform.position.y < -30f)
            {
                Destroy(this.gameObject);
            }
        }
Exemple #5
0
 private void PlaySound()
 {
     // Some sound for waiting the notes ...
     if (!NoteView.FirstNotePlayed)
     {
         //! [Example PlayNote]
         midiStreamPlayer.MPTK_PlayEvent
         (
             new MPTKEvent()
         {
             Channel  = 9,
             Duration = 999999,
             Value    = 48,
             Velocity = 100
         }
         );
     }
     //! [Example PlayNote]
 }
Exemple #6
0
        //
        /// <summary>
        /// Update
        ///! @code
        /// midiFilePlayer.MPTK_PlayNote(note);
        /// FirstNotePlayed = true;
        ///! @endcode
        /// </summary>
        public void Update()
        {
            if (!played && transform.position.x < -45f)
            {
                played = true;
                // If original z is not the same, the value will be changed, too bad for the ears ...
                int delta = (int)(zOriginal - transform.position.z);
                //Debug.LogFormat("{0} {1} {2}", zOriginal, transform.position.z, delta);
                //! [Example PlayNote]
                note.Value += delta;
                // Now play the note
                midiStreamPlayer.MPTK_PlayEvent(note);
                //! [Example PlayNote]
                FirstNotePlayed = true;

                gameObject.GetComponent <Renderer>().material = MatPlayed;// .color = Color.red;
            }
            if (transform.position.y < -30f)
            {
                Destroy(this.gameObject);
            }
        }