private void PlaySound(int i) { if (_audioRef != null && _sounds[i] == "HiHat") { _audioRef.StopSound(); _audioRef = null; } if (_sounds[i] == "OpenHiHat" && Audio.HandlePlaySoundAtTransformWithRef != null) { _audioRef = Audio.HandlePlaySoundAtTransformWithRef(_sounds[i], transform, false); } else { Audio.PlaySoundAtTransform(_sounds[i], transform); } }
private void PressButton(KMSelectable button) { button.AddInteractionPunch(.25f); var ix = Array.IndexOf(buttons, button); if (!easterEggUsed && ix != 2) { easterEggUsed = true; audio.PlaySoundAtTransform(ix == 0 ? "fellInLuv" : ix == 1 ? "shoota" : "kidCudi", transform); } if (moduleSolved) { return; } switch (buttonDirections[ix]) { case 0: currentLocation += currentLocation / 5 == 0 ? 20 : -5; break; case 1: currentLocation += currentLocation % 5 == 4 ? -4 : 1; break; case 2: currentLocation += currentLocation / 5 == 4 ? -20 : 5; break; case 3: currentLocation += currentLocation % 5 == 0 ? 4 : -1; break; default: throw new Exception(string.Format("buttonDirections[{0}] has an unexpected value.", ix)); } if (audioRef != null) { audioRef.StopSound(); audioRef = null; } audioRef = audio.HandlePlaySoundAtTransformWithRef(buttonLyrics[ix], button.transform, false); }