using Animancer;
using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
using GameLogic.Combat.CombatTool;
using GameLogic.Combat.Hero;
using GameLogic.Combat.Hero.SubStatus;
using UnityEngine;
using UnityEngine.AI;
using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
namespace GameLogic.Combat.Skill
{
///
/// 小蛇精英怪技能 向前冲撞,对冲撞的敌人造成伤害
///
public class S120001 : SkillBasic
{
private float _harm;
private bool _startMove;
private Vector3 moveTargetPos;
private Vector3 moveStartPos;
private float _currTime;
private float _currAddTime;
// protected BetterList
protected override void ProInitSkill()
{
_harm = SelfSkillConfig.effectValue[0];
}
protected override void ProUseSkill()
{
ActivationTimeLineData("sk1");
}
// protected override ILifetCycleHitPoint[] ProGetTineLineTargetEntity(
// TimeLineEventLogicBasic timeLineEventLogicBasic)
// {
// ILifetCycleHitPoint[] lifetCycleHitPoints = new ILifetCycleHitPoint[_enterAlertTarget.Count];
//
// for (int i = 0; i < _enterAlertTarget.Count; i++)
// {
// CombatHeroHitPoint combatHeroHitPoint = _enterAlertTarget[i].GetMainHotPoin();
// lifetCycleHitPoints[i] = combatHeroHitPoint;
// }
// return lifetCycleHitPoints;
// }
protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
ITimelineFxLogic timelineFxLogic,
TriggerData triggerData)
{
_startMove = true;
moveStartPos = CombatHeroEntity.dotPos;
moveTargetPos = CombatHeroEntity.combatHeroGameObject.transform.TransformPoint(new Vector3(0, 0, 5));
_currTime = 0;
_currAddTime = 1.0f / 0.5f;
}
protected override void ProCombatUpdate(float time)
{
if (!_startMove)
{
return;
}
_currTime += time * _currAddTime;
Vector3 t = Vector3.Lerp(moveStartPos, moveTargetPos, _currTime);
CombatHeroEntity.CombatAIBasic.NavMeshAgent.Raycast(t,
out NavMeshHit hit);
if (!hit.hit)
{
CombatHeroEntity.combatHeroGameObject.SetPosition(t);
}
else
{
Debug.Log(("打到墙了" + hit.mask));
}
if (_currTime >= 1)
{
_startMove = false;
}
}
protected override void ProHeroEnter(TimeLineAlertSeriailztion timeLineAlertSeriailztion,
CombatHeroEntity target)
{
long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(
CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
_harm);
CombatHeroHitPoint combatHeroHitPoint = target.GetMainHotPoin();
HarmReturnInfo harmReturnInfo = Harm(CombatHeroEntity, combatHeroHitPoint,
v, AttType.Skill, triggerData);
Vector3 dir = target.combatHeroGameObject.transform.forward * -1;
float d = (target.dotPos - CombatHeroEntity.dotPos).magnitude;
float moveDis = 3 - d;
moveDis = Mathf.Clamp(moveDis, 0, 3);
float jiao = Vector3.Dot(target.combatHeroGameObject.transform.forward,
CombatHeroEntity.combatHeroGameObject.transform.forward);
jiao = Mathf.Abs(jiao);
if (jiao > 0.9)
{
dir += new Vector3(0.8f, 0, 0);
}
RepelledStatusState repelledStatusState = new RepelledStatusState(dir, moveDis*jiao, 10, null);
target.CombatAIBasic.AddSubStatus(repelledStatusState);
}
protected override void ProSkillPlayFinish()
{
_startMove = false;
}
}
}