public void PlayInfoClips() { if (trackableObjects.Count < 1) { Debug.Log("No Trackables Found!"); return; } if (currentTrackedPlayAudioTarget == null || currentTrackedPlayAudioTarget.GetComponentInChildren <PlayAudio>() == null) { Debug.Log("No PlayAudio script attached to this object, or there is no active trackable target atm!"); return; } breakOutOfQuestions = true; if (playAudio != null) { playAudio.PlayInfoClipOnClick(); if (userSettings != null) { userSettings.FadeBGMusicVolume(playAudio.GetAudioSource().clip.length + 0.5f); } } }
public void PlayInfoClips() { if (trackableObjects.Count == 1) { playAudio = currentTrackedTarget.gameObject.GetComponentInChildren <PlayAudio>(); playAudio.PlayInfoClipOnClick(); if (userSettings != null) { userSettings.FadeBGMusicVolume(playAudio.GetAudioSource().clip.length + 0.5f); } } }
void GetCurrentTrackableObjects() { // Get the StateManager StateManager sm = TrackerManager.Instance.GetStateManager(); IEnumerable <TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours(); //noOfActiveTrackables = activeTrackables.Count(); // Iterate through the list of active trackables foreach (TrackableBehaviour tb in activeTrackables) { if (tb.TrackableName != "action-card" && tb.TrackableName != "groundcard" && tb.TrackableName != "BigFishMarker") { currentTrackedPlayAudioTarget = tb; animalNameTimer += Time.deltaTime; if (currentTrackedPlayAudioTarget.GetComponentInChildren <PlayAudio>() != null) { playAudio = currentTrackedPlayAudioTarget.GetComponentInChildren <PlayAudio>(); } if (!playedAnimalNameOnce && animalNameTimer >= passedTime) { playedAnimalNameOnce = true; playedAnimalVoiceOnce = false; if (playAudio != null) { playAudio.PlayAnimalNameClipOnClick(); passedTime = passedTime + playAudio.currentClipLength + audioClipsInterval; } } if (playedAnimalNameOnce && animalNameTimer >= passedTime) { if (playAudio != null) { if (playAudio.indexNumber == 0 && !playedAnimalVoiceOnce) { playedAnimalVoiceOnce = true; playAudio.PlayAnimalSoundClipOnClick(); passedTime = passedTime + playAudio.currentClipLength + audioClipsInterval; } else { if (playAudio.indexNumber > playAudio.maxArrayLength - 1) { playedAnimalNameOnce = false; playAudio.indexNumber = 0; } else { playAudio.PlayInfoClipOnClick(); passedTime = passedTime + playAudio.currentClipLength + audioClipsInterval; } } } } } if (tb.TrackableName != "groundcard" && tb.TrackableName != "BigFishMarker") { bigMarkerTrackable = tb; } currentTrackedTarget = tb; trackableObjects.Add(currentTrackedTarget); } }