123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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<GameObjectPool>("fx_hudun", null);
- ShieldsFx = combatParticleSystemPool;
- BarrierEntityMono barrierEntityMono = combatParticleSystemPool.own.GetComponent<BarrierEntityMono>();
- if (barrierEntityMono == null)
- {
- barrierEntityMono =
- combatParticleSystemPool.own.AddComponent<BarrierEntityMono>();
- }
- barrierEntityMono.Barrier = this;
- SpecialDotInfo specialDotInfo =
- combatHeroEntity.GetMainHotPoin<CombatHeroHitPoint>(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<ParticleSystem>();
- }
- public void Play()
- {
- ShieldsFx.ActiveObj();
- for (int i = 0; i < allParticleSystem.Length; i++)
- {
- allParticleSystem[i].Stop();
- allParticleSystem[i].Play();
- }
- }
- /// <summary>
- /// 破裂
- /// </summary>
- public async CTask Rupture()
- {
- ParticleSystemPool particleSystemPool =
- await GObjectPool.Instance.FetchAsync<ParticleSystemPool>("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;
- }
- }
- }
|