public void SetJungleMonsterBeAtkVoice() { int id = (int)ObjTypeID; NpcConfigInfo info = ConfigReader.GetNpcInfo(id); if (entityType != EntityType.Monster || Hp < hpLimit || AudioManager.Instance.HeroLinesAudioDict.ContainsKey(GameObjGUID)) { return; } List <float> ifPlaySoundList = new List <float>(); for (int i = 0; i < ifPlayMonsterSound.Length; i++) { ifPlaySoundList.Add(ifPlayMonsterSound[i]); } int indexPlay = GameMethod.RandProbablityIndex(ifPlaySoundList);//获得是否播放下标 if (indexPlay == 1) { return; } if (HasSameTypeNpcPlaySoundIsPlaying()) { return; } if (info.n32Script1Rate == null) { return; } List <float> probabilityList = GameMethod.ResolveToFloatList(info.n32Script1Rate);//获得概率集合 for (int i = 0; i < probabilityList.Count; i++) { probabilityList[i] = (float)(probabilityList[i] - 90000) / 100f; } int index = GameMethod.RandProbablityIndex(probabilityList); //获得概率下标 List <string> voiceList = GameMethod.ResolveToStrList(info.un32Script1); string name = voiceList[index]; //获得概率下标对应的声音 string path = AudioDefine.PATH_JUNGLE_MONSTER_BE_ATK_SOUND + name; //AudioClip clip = Resources.Load(path) as AudioClip; ResourceItem clipUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioManager.Instance.PlayHeroLinesAudio(GameObjGUID, clip); }