Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        //Images that represent the differnt parts of the Drum
        this.drumParts = FindObjectsOfType <InputBehaviour> ();

        this.midiCrontoller = new MidiDrumScript(this.gameObject);
        this.missedNotes    = 0;
        this.onBeatNotes    = 0;
        this.offBeatNotes   = 0;

        this.totalNotes = FindObjectsOfType <NoteBehaviour> ().Length;

        this.isPaused = false;

        //Funcionality for the resume button in the pause menu
        resumeButton.onClick.AddListener(
            delegate {
            this.musicTrack.Play();
            this.pauseMenu.SetActive(false);
            this.isPaused = false;
        });

        //Funcionality for the exit button in the pause menu
        exitButton.onClick.AddListener(
            delegate {
            //Before changing the scenes we need to close the port so we can open it later
            this.midiCrontoller.closePort();
            SceneManager.LoadScene("trackSelectionScene");
        });

        //Funcionality for the restart button in the pause menu
        restartButton.onClick.AddListener(
            delegate {
            //Before changing the scenes we need to close the port so we can open it later
            this.midiCrontoller.closePort();
            SceneManager.LoadScene(Utilities.getCurrentTrackScene());
        });

        //Funcionality for the button to pause the play mode
        pauseButton.onClick.AddListener(
            delegate {
            if (!this.isPaused)
            {
                this.musicTrack.Pause();
                this.pauseMenu.SetActive(true);
                this.isPaused = true;
            }
        });

        StartCoroutine(PlaySong());

        /*//We load the audio from the track that is selected and we play it
         * this.musicTrack.clip = Resources.Load (Utilities.getCurrentTrack()) as AudioClip;
         * this.musicTrack.Play ();
         *
         * this.isStarted = true;*/
        //We set the value of the instance
        instance = this;
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //Images that represent the differnt parts of the Drum
        this.drumParts = FindObjectsOfType <InputBehaviour> ();

        //Button to exit the free mode
        backButton = GameObject.Find("BackButton").GetComponent <Button>();
        backButton.onClick.AddListener(delegate {
            SceneManager.LoadScene("mainMenu");
        });

        this.midiCrontoller = new MidiDrumScript(this.gameObject);
        this.volume         = 0;
        this.sensor         = 0;
        this.arduinoInput   = "";
    }