using Common.Combat.FxAILogic;
using Core.Triiger;
using GameLogic.Combat.CombatTool;
using GameLogic.Combat.Hero;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using UnityEngine;
namespace GameLogic.Combat.Skill.MagicSkill
{
///
/// 玄龟盾:前方形成一个土系防御盾,抵挡敌人伤害
///
public class S3501 : MagicSkillBasic, ITriggerEntity, IBarrier
{
public string tag { get; }
private IUnRegister _unRegister;
private bool _use;
private long _currHp;
protected GameObject pengZhuang;
private bool isUpdate;
// protected bool
private SpecialDotInfo specialDotInfo;
protected override void ProMagicUseSkill()
{
isUpdate = false;
specialDotInfo =
CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.GetSpecialDotInfo("zdpos1");
MagicAttShowBasic magicAttShowBasic = InitXiaoShiAndShow(specialDotInfo.GetWorlPos(), Finish);
SetMagicAttShowBasic(magicAttShowBasic);
}
public ShowBaiscEntity Own { get; set; }
public BarrierTriggerData BarrierTriggerData { get; set; }
private void Finish()
{
isUpdate = true;
ActivationTimeLineData("sk1");
Own = CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity;
if (pengZhuang == null)
{
pengZhuang = new GameObject("pengzhaung");
SphereCollider sphereCollider = pengZhuang.AddComponent();
sphereCollider.isTrigger = true;
sphereCollider.radius = 2.5f;
}
pengZhuang.SetActive(true);
BarrierEntityMono barrierEntityMono =
pengZhuang.GetOrAddComponent();
pengZhuang.transform.position = CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.dotPos;
pengZhuang.transform.SetParent(CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.GameObject
.transform);
barrierEntityMono.Barrier = this;
_use = true;
_currHp = (long)SelfSkillConfig.effectValue[0];
}
public bool CollideTriiger(ITriggerEntity triggerEntity)
{
return !_use || _currHp <= 0;
}
protected override void ProDispose()
{
if (pengZhuang != null)
{
pengZhuang.SetActive(false);
pengZhuang = null;
}
}
protected override void MagicSkillUpdate(float time)
{
if (isUpdate)
{
CombatMagicWeaponEntity.GameObject.transform.position = specialDotInfo.GetWorlPos();
}
}
public long Harm(HarmReturnInfo harmReturnInfo)
{
_currHp -= harmReturnInfo.att;
if (_currHp <= 0) //盾破
{
isUpdate = false;
SkillPlayFinish();
pengZhuang.SetActive(false);
Debug.Log("盾破了,做表现的时候一起做");
}
return 0;
}
}
}