private IEnumerator LoadSound(string _animal) { if (audioEmitter == null) { audioEmitter = GetComponentInChildren <AudioSource>(); } if (audioEmitter != null) { while (audioEmitter.isPlaying) { yield return(null); } string fileName = ApplicationScript.getDataFolder() + "audio/" + _animal + "_" + (int)ApplicationScript.current.currentLanguage + ".wav"; WWW www = new WWW("file://" + fileName); AudioClip clip = www.GetAudioClip(false); while (clip.loadState == AudioDataLoadState.Loading) { yield return(www); } if (string.IsNullOrEmpty(www.error)) { audioEmitter.clip = www.GetAudioClip(false); clip.name = Path.GetFileName(fileName); } else { Debug.LogWarning(www.error); } } }
private void Awake() { DontDestroyOnLoad(this); if (instance != null) { Debug.LogWarning("More than one applicationScript instance"); Destroy(gameObject); return; } instance = this; }
public static void OnScriptLoaded(ApplicationScript script) { LoggingService.Info("Loaded: " + script.Path); }