123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- using System.Collections.Generic;
- using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
- using Common.Combat.FxAILogic;
- using Core.Triiger;
- using Fort23.Core;
- using GameLogic.Combat.CombatTool;
- using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
- using UnityEngine;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- namespace GameLogic.Combat.Skill.MagicSkill
- {
- public class S3401FxMove : CObject
- {
- public Vector3 endPos;
- public FxAILogicBasic fxAILogicBasic;
- public float moveSpeed = 8;
- private System.Action finishCallBack;
- private bool isUpdate;
- private float moveTime;
- public void InitActive(Vector3 endPos, System.Action finishCallBack)
- {
- this.endPos = endPos;
- moveTime = 0;
- this.finishCallBack = finishCallBack;
- isUpdate = true;
- }
- public override void ActiveObj()
- {
- }
- public override void DormancyObj()
- {
- fxAILogicBasic = null;
- isUpdate = false;
- }
- public bool Update(float t)
- {
- if (!isUpdate)
- {
- return false;
- }
- Vector3 pos = fxAILogicBasic.gameObject.transform.position;
- Vector3 dir = endPos - pos;
- float distance = dir.magnitude;
- float addT = 1.0f / (distance / moveSpeed);
- moveTime += t * addT;
- Vector3 d = Vector3.Lerp(pos, endPos, moveTime);
- fxAILogicBasic.gameObject.transform.position = d;
- if (moveTime >= 1)
- {
- fxAILogicBasic.Dispose();
- finishCallBack?.Invoke();
- isUpdate = false;
- CObjectPool.Instance.Recycle(this);
- return false;
- }
- return true;
- }
- }
- /// <summary>
- /// 宝塔在英雄的头顶前往位置旋转,形成一个扇形区域,敌人的功法如果进入这个扇形区域有很大的概率被法宝吸收
- ///(飞到玩家头顶持续施法)
- /// 100%吸收,切吸收后临时增加玩家对于吸收功法的灵根
- /// </summary>
- public class S3401 : MagicSkillBasic, ITriggerEntity
- {
- private List<S3401FxMove> _currTriggerFx = new List<S3401FxMove>();
- private float _currTime;
- private bool _isUpdae;
- private IUnRegister _unRegister;
- protected override void ProMagicUseSkill()
- {
- TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic = ActivationTimeLineData("sk1_xiaoshi");
- timeLineEventLogicGroupBasic.TimeLineUpdateEnd = delegate()
- {
- Transform root = CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.GameObject.transform;
- Vector3 pos = root.TransformPoint(new Vector3(0, 4, 4));
- Quaternion quaternion = Quaternion.Euler(120, 0, 0);
- CombatHeroEntity.GameObject.transform.rotation = root.rotation * quaternion;
- // Vector3 d = root.rotation * _dir;
- CombatHeroEntity.GameObject.transform.position = pos;
- TimeLineEventLogicGroupBasic sk1_show = ActivationTimeLineData("sk1_show");
- sk1_show.TimeLineUpdateEnd = ShowFinish;
- };
- }
- protected void ShowFinish()
- {
- ActivationTimeLineData("sk1");
- SpecialDotInfo specialDotInfo =
- CombatMagicWeaponEntity.GetSpecialDotInfo("sk1");
- _unRegister = specialDotInfo.targetTran.gameObject.OnTriggerEnterEvent(this, OnTriggerExitEvent);
- _isUpdae = true;
- }
- protected override void MagicSkillUpdate(float time)
- {
- for (int i = 0; i < _currTriggerFx.Count; i++)
- {
- S3401FxMove fxMove = _currTriggerFx[i];
- bool isUpdate = fxMove.Update(time);
- if (!isUpdate)
- {
- _currTriggerFx.RemoveAt(i);
- i--;
- }
- }
- if (!_isUpdae)
- {
- return;
- }
- _currTime += time;
- if (_currTime > effectValue[1])
- {
- _isUpdae = false;
- SkillPlayFinish();
- }
- }
- protected override void ProSkillPlayFinish()
- {
- _isUpdae = false;
- _unRegister.UnRegister();
- CombatHeroEntity.CloseLoopFx();
- }
- protected override void ProBreakMagicSkill()
- {
- _isUpdae = false;
- SkillPlayFinish();
- }
- private void OnTriggerExitEvent(Collider collider, ITriggerEntity triggerEntity)
- {
- if (triggerEntity == null)
- {
- return;
- }
- FxAILogicBasic fxAILogicBasic = triggerEntity as FxAILogicBasic;
- if (fxAILogicBasic != null && fxAILogicBasic.CombatHeroEntity.IsEnemy != CombatHeroEntity.IsEnemy)
- {
- if (!fxAILogicBasic.isInit)
- {
- return;
- }
- int odds = CombatCalculateTool.Instance.GetOdd(0, 100);
- if (odds < effectValue[0])
- {
- fxAILogicBasic.isNotMove = true;
- S3401FxMove fxMove = CObjectPool.Instance.Fetch<S3401FxMove>();
- fxMove.fxAILogicBasic = fxAILogicBasic;
- fxMove.InitActive(CombatHeroEntity.dotPos, null);
- _currTriggerFx.Add(fxMove);
- }
- }
- }
- public string tag { get; }
- }
- }
|