| | |
| | | using DG.Tweening; |
| | | using Spine; |
| | | using System.Linq; |
| | | using PlasticGui.WorkspaceWindow.BranchExplorer; |
| | | |
| | | |
| | | public class SkillBase |
| | |
| | | case SkillCastMode.Allies: |
| | | CastToAllies(); |
| | | break; |
| | | // case SkillCastMode.DashCast: |
| | | // DashToTarget(() => BackToOrigin(OnSkillFinished)); |
| | | // break; |
| | | case SkillCastMode.DashCast: |
| | | DashCast(OnAttackFinish); |
| | | break; |
| | | default: |
| | | Debug.LogError("暂时不支持其他的方式释放 有需求请联系策划 技能id:" + skillConfig.SkillID + " cast position " + skillConfig.CastPosition); |
| | | OnSkillFinished(); |
| | | Debug.LogError("强制结束技能 暂时不支持其他的方式释放 有需求请联系策划 技能id:" + skillConfig.SkillID + " cast position " + skillConfig.CastPosition); |
| | | ForceFinished(); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, float duration, Action onComplete = null) |
| | | // 冲撞攻击 |
| | | protected void DashCast(Action _onComplete) |
| | | { |
| | | Debug.LogError("DashCast 还没实现"); |
| | | ForceFinished(); |
| | | // YYL TODO |
| | | |
| | | // var entry = caster.motionBase.PlayAnimation(skillConfig.GetMotionName(), false); |
| | | // float animationTime = entry.AnimationTime; |
| | | |
| | | // int mainTargetPosNum = BattleUtility.GetMainTargetPositionNum(caster, tagUseSkillAttack.HurtList.ToList(), skillConfig); |
| | | |
| | | // BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp(); |
| | | |
| | | // RectTransform targetTrans = battleField.GetTeamNode(battleCamp, mainTargetPosNum); |
| | | |
| | | // var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, targetTrans, new Vector2(skillConfig.CastDistance, 0), animationTime * 0.9f, () => |
| | | // { |
| | | // caster.motionBase.PlayAnimation(MotionName.idle, true); |
| | | // _onComplete?.Invoke(); |
| | | // }); |
| | | // battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | | |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 500f) |
| | | { |
| | | // 原地释放 |
| | | if (skillConfig.CastDistance >= 9999) |
| | | { |
| | | onComplete?.Invoke(); |
| | | _onComplete?.Invoke(); |
| | | return; |
| | | } |
| | | |
| | | caster.motionBase.PlayAnimation(MotionName.run, true); |
| | | var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, duration, () => |
| | | var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, () => |
| | | { |
| | | caster.motionBase.PlayAnimation(MotionName.idle, true); |
| | | onComplete?.Invoke(); |
| | | }); |
| | | _onComplete?.Invoke(); |
| | | }, speed); |
| | | battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | | |
| | |
| | | |
| | | RectTransform target = battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig); |
| | | |
| | | MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), moveTime, () => |
| | | MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), () => |
| | | { |
| | | // 到位置转身(不一定非要转身 但是流程要写) |
| | | TurnBack(() => |
| | |
| | | () => |
| | | { |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, moveTime, |
| | | OnAttackFinish); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, |
| | | OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | |
| | | RectTransform targetTrans = battleField.GetTeamNode(battleCamp, mainTargetPosNum); |
| | | |
| | | MoveToTarget(targetTrans, new Vector2(skillConfig.CastDistance, 0), moveTime, () => |
| | | MoveToTarget(targetTrans, new Vector2(skillConfig.CastDistance, 0), () => |
| | | { |
| | | // 到位置转身(不一定非要转身 但是流程要写) |
| | | TurnBack(() => |
| | |
| | | TurnBack( |
| | | () => |
| | | { |
| | | RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum); |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, moveTime, |
| | | OnAttackFinish); |
| | | MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | { |
| | | RectTransform target = battleField.GetTeamNode(caster.Camp, skillConfig); |
| | | |
| | | MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), moveTime, () => |
| | | MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), () => |
| | | { |
| | | // 到位置转身(不一定非要转身 但是流程要写) |
| | | TurnBack(() => |
| | |
| | | { |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), |
| | | Vector2.zero, moveTime, OnAttackFinish); |
| | | Vector2.zero, OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | |
| | | protected void HighLightAllTargets() |
| | | { |
| | | if (skillConfig.FuncType != 2) |
| | | return; |
| | | |
| | | // 高亮所有目标 |
| | | HashSet<BattleObject> highlightList = new HashSet<BattleObject>(battleField.battleObjMgr.GetBattleObjList(tagUseSkillAttack)); |
| | | List<BattleObject> targetList = battleField.battleObjMgr.GetBattleObjList(tagUseSkillAttack); |
| | | List<BattleObject> highlightList = new List<BattleObject>(targetList); |
| | | highlightList.Add(caster); |
| | | |
| | | List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>(); |
| | | |
| | | caster.heroInfoBar.SetActive(false); |
| | | |
| | | for (int i = 0; i < allList.Count; i++) |
| | | { |
| | | BattleObject bo = allList[i]; |
| | | if (highlightList.Contains(bo)) |
| | | { |
| | | bo.layerMgr.SetFront(); |
| | | bo.heroInfoBar.SetActive(true); |
| | | bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true); |
| | | } |
| | | else |
| | | { |
| | | bo.layerMgr.SetBack(); |
| | | bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true); |
| | | } |
| | | |
| | | if (targetList.Contains(bo)) |
| | | { |
| | | bo.heroInfoBar.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | bo.heroInfoBar.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | caster.layerMgr.SetSortingOrder(BattleConst.ActiveHeroActionSortingOrder); |
| | | |
| | | battleField.battleRootNode.skillMaskNode.SetActive(true); |
| | | |
| | | // caster.battleField.skillMask |
| | | // 把这些BO全高亮 或者说把除了这些的都放在遮罩后面 |
| | | // YYL TODO |
| | | } |
| | |
| | | protected virtual void OnHitEachTarget(int _hitIndex, BattleObject target, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt) |
| | | { |
| | | // 伤害分布 (万分比) |
| | | // Debug.LogError("skillConfig.DamageDivide.Count " + skillConfig.DamageDivide.Length + " _hitIndex " + _hitIndex); |
| | | int[] damageDivide = skillConfig.DamageDivide[_hitIndex]; |
| | | |
| | | long totalDamage = GeneralDefine.GetFactValue(hurt.HurtHP, hurt.HurtHPEx); |
| | |
| | | } |
| | | } |
| | | |
| | | return isFinished && moveFinished; |
| | | if (isFinished && moveFinished) |
| | | { |
| | | List<BattleObject> allList = battleField.battleObjMgr.allBattleObjDict.Values.ToList<BattleObject>(); |
| | | for (int i = 0; i < allList.Count; i++) |
| | | { |
| | | BattleObject bo = allList[i]; |
| | | bo.layerMgr.SetFront(); |
| | | bo.heroRectTrans.SetParent(battleField.GetTeamNode(bo.Camp, bo.teamHero.positionNum), true); |
| | | bo.heroInfoBar.SetActive(true); |
| | | } |
| | | battleField.battleRootNode.skillMaskNode.SetActive(false); |
| | | |
| | | |
| | | |
| | | |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public virtual void ForceFinished() |
| | | { |
| | | skillEffect?.ForceFinished(); |
| | | isFinished = true; |
| | | moveFinished = true; |
| | | |
| | | while (packList.Count > 0) |
| | | { |