using Core.Triiger; using Fort23.Common; using Fort23.Core; using Fort23.UTool; using GameLogic.Combat.CombatTool; using UnityEngine; namespace GameLogic.Combat.Hero { public class ShieldsBarrier : IBarrier { public ShowBaiscEntity Own { get; set; } public GameObjectPool ShieldsFx; private ParticleSystem[] allParticleSystem; public async CTask Init(ShowBaiscEntity combatHeroEntity) { Own = combatHeroEntity; GameObjectPool combatParticleSystemPool = await GObjectPool.Instance.FetchAsync("fx_hudun", null); ShieldsFx = combatParticleSystemPool; BarrierEntityMono barrierEntityMono = combatParticleSystemPool.own.GetComponent(); if (barrierEntityMono == null) { barrierEntityMono = combatParticleSystemPool.own.AddComponent(); } barrierEntityMono.Barrier = this; SpecialDotInfo specialDotInfo = combatHeroEntity.GetMainHotPoin(true).GetSpecialDotInfo("hitpos"); ShieldsFx.own.transform.SetParent(specialDotInfo.targetTran); ShieldsFx.own.transform.localPosition = Vector3.zero; ShieldsFx.own.transform.localEulerAngles = Vector3.zero; ShieldsFx.own.transform.localScale = Vector3.one * 1.5f; ShieldsFx.SetActive(true); allParticleSystem = combatParticleSystemPool.own.transform.GetComponentsInChildren(); } public void Play() { ShieldsFx.ActiveObj(); for (int i = 0; i < allParticleSystem.Length; i++) { allParticleSystem[i].Stop(); allParticleSystem[i].Play(); } } /// /// 破裂 /// public async CTask Rupture() { ParticleSystemPool particleSystemPool = await GObjectPool.Instance.FetchAsync("fx_hudun_po", null); particleSystemPool.gameObject.transform.position = ShieldsFx.own.transform.position; } public bool CollideTriiger(ITriggerEntity triggerEntity) { if (Own.CurrCombatHeroInfo.Shield > 0) { return false; } return true; } public void Harm(HarmReturnInfo harmReturnInfo) { Play(); harmReturnInfo.target.combatHeroEntity.CurrCombatHeroInfo.Shield -= harmReturnInfo.att; if (harmReturnInfo.target.combatHeroEntity.CurrCombatHeroInfo.Shield <= 0) { Rupture(); } } public void Dispose() { GObjectPool.Instance.Recycle(ShieldsFx); allParticleSystem = null; ShieldsFx = null; Own = null; } } }