12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using Core.Triiger;
- using Fort23.Common;
- using Fort23.Core;
- using Fort23.UTool;
- 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 Dispose()
- {
- GObjectPool.Instance.Recycle(ShieldsFx);
- allParticleSystem = null;
- ShieldsFx = null;
- Own = null;
- }
- }
- }
|