private void getEnum(string _instrument) { if (_instrument.Equals("TUBA", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.TUBA; } if (_instrument.Equals("HARMONICA", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.HARMONICA; } if (_instrument.Equals("DRUMS", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.DRUMS; } if (_instrument.Equals("HARP", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.HARP; } if (_instrument.Equals("PIANO", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.PIANO; } if (_instrument.Equals("SAXOPHONE", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.SAXOPHONE; } if (_instrument.Equals("TRUMPET", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.TRUMPET; } if (_instrument.Equals("VIOLIN", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.VIOLIN; } if (_instrument.Equals("GUITAR", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.GUITAR; } if (_instrument.Equals("FLUTE", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.FLUTE; } if (_instrument.Equals("MARIMBA", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.MARIMBA; } if (_instrument.Equals("MARACAS", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.MARACAS; } if (_instrument.Equals("CELLO", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.CELLO; } if (_instrument.Equals("CLARINET", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.CLARINET; } if (_instrument.Equals("ACCORDION", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.ACCORDION; } if (_instrument.Equals("TRIANGLE", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.TRIANGLE; } if (_instrument.Equals("TAMBOURINE", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.TAMBOURINE; } if (_instrument.Equals("CYMBALS", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.CYMBALS; } if (_instrument.Equals("XYLOPHONE", System.StringComparison.OrdinalIgnoreCase)) { _enumInstrument = InstrumentController.ENUMINSTRUMENT.XYLOPHONE; } }
public void checkInstrument(InstrumentController.ENUMINSTRUMENT _enumInstrument, bool instrumentWord) { isPlaying = false; float clipDuration = 0; if (instrumentWord) { director.SetActive(false); turnQuietInstruments(); //Player said an instrument if (!showingPattern) { if (_enumInstrument == patronList[currentPatron - 1][contChecking].instrument) { SaveSystem.increaseMicrophonePressedTime(true, _enumInstrument.ToString(), ChangeScene.EspikinglishMinigames.ORCHESTA); foreach (Transform child in instrumentsGameObject.transform) { if (child.gameObject.GetComponent <InstrumentController>()._instrument == _enumInstrument && !isPlaying) { child.gameObject.GetComponent <InstrumentController>().setMemberPlaying(); child.gameObject.GetComponent <InstrumentController>().playSound(); child.gameObject.GetComponent <InstrumentController>().playClip(); isPlaying = true; clipDuration = child.gameObject.GetComponent <InstrumentController>().getSoundTime(); } } patternPanel.turnOnNote(contChecking); contChecking++; if (contChecking > patronList[currentPatron - 1].Length - 1) { //Muy bien, ganaste Invoke("winGame", clipDuration); //messageInScreen.GetComponent<ScreenMessage>().winScreen(); } } else { //Decir que le quedó mal feedback.playWrong(); fade.disableSpeechButton(); SaveSystem.increaseMicrophonePressedTime(false); foreach (Transform child in instrumentsGameObject.transform) { child.gameObject.GetComponent <InstrumentController>().setQuietInstrument(); } Invoke("endGame", feedback.getWrongLength() + 0.5f); } GetComponent <PatternCheckOrchesta>().canTalk = true; } } else { //wrong pronunciation feedback.playQuestion(); SaveSystem.increaseMicrophonePressedTime(false); } }