private IEnumerator ShowAOE(List <BulletTarget> targetList, Vector3 position, ClientSkill skill) { if (skill.Prop.skill_select_type != Def.SkillSelectType.PlayerSelect) { StartCoroutine(UpdatePosition()); CoroutineJoin join = new CoroutineJoin(AssetLoader.Instance); for (int i = 0; i < targetList.Count; i++) { BulletTarget bulletTarget = targetList[i]; TeamDisplay target = bulletTarget.Target; if (target == null) { continue; } join.StartSubtask(ShowHurtEffect(target, bulletTarget.delayFrame)); } yield return(join.WaitForAll()); } else { Global.ShowHurtEffect(null, HurtEffect_, position); } yield return(null); StartCoroutine(WaitAndDestroy(true, 2f)); }
/// <summary> /// 播放特效 /// </summary> /// <param name="trans"></param> /// <param name="effect"></param> /// <param name="position"></param> /// <param name="isBind"></param> /// <returns></returns> public IEnumerator PlayEffect(Transform trans, Effect effect, Vector3 position, bool isBind) { CoroutineJoin join = new CoroutineJoin(AssetLoader.Instance); join.StartSubtask(DoPlayEffect(trans, effect, position, isBind)); join.StartSubtask(DoPlaySound(effect.audioPath, position, true)); yield return(join.WaitForAll()); }
/// <summary> /// 预加载舰船数据 /// </summary> /// <returns></returns> public Coroutine PreloadShipDefines() { XmlResourceList.Item[] allShip = null; allShip = RemoteResourceList.FindItem(PalmPoineer.Defines.AssetExt.ShipDefine); if (allShip == null) { Debug.Log("Ship List is null"); return(null); } CoroutineJoin join = new CoroutineJoin(this); foreach (var item in allShip) { join.StartSubtask(LoadShip(item.Path)); } Debug.Log("Total ship Defines: " + allShip.Length); return(join.WaitForAll()); }
/// <summary> /// 创建所有舰船 /// </summary> /// <returns></returns> private IEnumerator CreateAllShips() { CoroutineJoin join = new CoroutineJoin(AssetLoader.Instance); // player for (int i = 0; i < BattleSys.GetShipCount(true); i++) { ClientShip clientShip = BattleSys.GetShipByIndex(true, i); join.StartSubtask(CreateShip(true, clientShip)); } // enemy for (int i = 0; i < BattleSys.GetShipCount(false); i++) { ClientShip clientShip = BattleSys.GetShipByIndex(false, i); join.StartSubtask(CreateShip(false, clientShip)); } yield return(join.WaitForAll()); }
/// <summary> /// 预加载资源 /// </summary> /// <param name="assetPathes"></param> /// <param name="dontDestoryOnLoad"></param> /// <param name="needBundle">是否需要保留bundle,如果不需要,会调用AssetBundle.Unload</param> /// <returns></returns> public static IEnumerator PreloadAssets(bool dontDestoryOnLoad, bool needBundle, params string[] assetPathes) { CoroutineJoin join = new CoroutineJoin(AssetLoader.Instance); foreach (var path in assetPathes) { if (CachedAssets.ContainsKey(path)) { while (!CachedAssets[path].bLoaded) { yield return(null); } continue; } Cache c = new Cache(); c.bLoaded = false; CachedAssets[path] = c; join.StartSubtask(DoPreloadAsset(path, dontDestoryOnLoad, needBundle)); } yield return(join.WaitForAll()); }