Beispiel #1
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        switch (collision.gameObject.tag)
        {
        case "play":
            boton_play.Select();
            break;

        case "calibrate":
            boton_calibrate.Select();
            break;

        case "about":
            boton_about.Select();
            break;
        }

        if (PSMoveService.ButtonState(0, 2))
        {
            //Debug.Log("Presionado");
            switch (collision.gameObject.tag)
            {
            case "play":
                //yield return new WaitForSeconds(2f);
                PSMoveService.SetRumble(PSMoveService.Cliente, 0, 0.0f);
                SceneManager.LoadScene("Drum3D");
                break;

            case "calibrate":
                //yield return new WaitForSeconds(2f);
                PSMoveService.SetRumble(PSMoveService.Cliente, 0, 0.0f);
                SceneManager.LoadScene("Calibracion");
                break;

            case "about":
                //yield return new WaitForSeconds(2f);
                PSMoveService.SetRumble(PSMoveService.Cliente, 0, 0.0f);
                //SceneManager.LoadScene("Drum3D");
                break;
            }
        }

        /*
         * switch (collision.gameObject.tag)
         * {
         *  case "play":
         *      MIDI.SendNota(26, 127);
         *      Debug.Log("Ingrese");
         *      Debug.Log(other.GetComponent<Renderer>().material.color);
         *      break;
         *  case "calibrate":
         *      MIDI.SendNota(71, 127);
         *      break;
         *  case "about":
         *      MIDI.SendNota(30, 127);
         *      break;
         * }
         */
    }
    //private IEnumerator OnTriggerEnter(Collider other)
    private IEnumerator OnTriggerEnter(Collider other)
    {
        int id;
        int velocidad = 100;

        if (this.CompareTag("left_mando"))
        {
            id = 0;
        }
        else
        {
            id = 1;
        }

        //velocidad = Clamp(PSMoveService.mando_right.vel_j);


        switch (other.gameObject.tag)
        {
        case "esferasnare":
            MIDI.SendNota(26, velocidad);
            Debug.Log("Ingrese");
            Debug.Log(other.GetComponent <Renderer>().material.color);
            break;

        case "ride":
            MIDI.SendNota(71, velocidad);
            break;

        case "hihat":
            MIDI.SendNota(30, velocidad);
            break;

        case "middletom":
            MIDI.SendNota(35, velocidad);
            break;

        case "hitom":
            MIDI.SendNota(38, velocidad);
            break;

        case "floortom":
            MIDI.SendNota(31, velocidad);
            break;
        }

        PSMoveService.SetRumble(PSMoveService.Cliente, id, 0.5f);
        yield return(new WaitForSeconds(0.5f));

        PSMoveService.SetRumble(PSMoveService.Cliente, id, 0.0f);
    }
    private IEnumerator OnTriggerStay(Collider other)
    {
        Debug.Log(cuenta_regresiva);
        isCollision = true;
        if (cuenta_regresiva == 0)
        {
            if (other.CompareTag("esferasnare"))
            {
                other.GetComponent <Renderer>().material.color = Color.red;
                texto_cal.SetActive(true);
                yield return(new WaitForSeconds(2f));

                PSMoveService.SetRumble(PSMoveService.Cliente, 0, 0.0f);
                SceneManager.LoadScene("Drum3D");
            }
        }
    }