| | |
| | | |
| | | public class RendererAdjuster : MonoBehaviour |
| | | { |
| | | public int renderQueue = 3000; |
| | | |
| | | public int sortingOrder = 0; |
| | | |
| | |
| | | |
| | | public List<Renderer> renderers = new List<Renderer>(); |
| | | |
| | | protected Canvas canvas; |
| | | |
| | | public Action<string, int> onSortingChanged; |
| | | |
| | | protected void Awake() |
| | | { |
| | | UpdateComps(); |
| | | } |
| | | |
| | | public void SetSortingOrder(int sortingOrder) |
| | | { |
| | |
| | | UpdateSortingOrder(); |
| | | } |
| | | |
| | | public void Awake() |
| | | { |
| | | UpdateComps(); |
| | | } |
| | | |
| | | protected void OnEnable() |
| | | { |
| | | UpdateComps(); |
| | | UpdateSortingOrder(); |
| | | } |
| | | |
| | | protected void UpdateComps() |
| | | { |
| | | renderers.Clear(); |
| | | renderers.AddRange(gameObject.GetComponentsInChildren<Renderer>(true)); |
| | | |
| | | canvas = GetComponent<Canvas>(); |
| | | } |
| | | |
| | | public void UpdateSortingOrder() |
| | |
| | | // 将特效的排序顺序设置为Canvas排序顺序加上偏移量 |
| | | ApplySortingSettings(sortingOrder, customSortingLayer); |
| | | } |
| | | |
| | | |
| | | private void ApplySortingSettings(int sortingOrder, string sortingLayer) |
| | | { |
| | |
| | | if (renderer != null) |
| | | { |
| | | renderer.sortingOrder = sortingOrder; |
| | | renderer.material.renderQueue = renderQueue; // 设置渲染队列 |
| | | // renderer.material.renderQueue = overlayRQ; |
| | | if (!string.IsNullOrEmpty(sortingLayer)) |
| | | { |
| | | renderer.sortingLayerName = sortingLayer; |
| | |
| | | } |
| | | } |
| | | |
| | | if (null != canvas) |
| | | { |
| | | canvas.sortingOrder = sortingOrder; |
| | | if (!string.IsNullOrEmpty(sortingLayer)) |
| | | { |
| | | canvas.sortingLayerName = sortingLayer; |
| | | } |
| | | } |
| | | |
| | | onSortingChanged?.Invoke(sortingLayer, sortingOrder); |
| | | } |
| | | } |
| | |
| | | public bool isRedCamp = true; |
| | | public EffectConfig effectConfig; |
| | | |
| | | public float speedRate = 1f; |
| | | public float speedRate = 1.5f; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | public Action<BattleEffectPlayer> onDestroy; |
| | | |
| | | [HideInInspector] public Canvas canvas = null; |
| | | |
| | | [HideInInspector] public GameObject effectTarget = null; |
| | | |
| | | protected EffectPenetrationBlocker blocker = null; |
| | | protected RendererAdjuster blocker = null; |
| | | |
| | | protected bool isInit = false; |
| | | |
| | |
| | | |
| | | protected SkeletonAnimation spineComp; |
| | | protected Spine.AnimationState spineAnimationState; |
| | | |
| | | protected int heroSetedSortingOrder; |
| | | |
| | | public GameObjectPoolManager.GameObjectPool pool; |
| | | |
| | |
| | | onComplete?.Invoke(); |
| | | } |
| | | |
| | | public virtual void Play(bool showLog = true) |
| | | public void SetSortingOrder(int _heroSetedSortingOrder) |
| | | { |
| | | heroSetedSortingOrder = _heroSetedSortingOrder; |
| | | |
| | | int so = heroSetedSortingOrder; |
| | | |
| | | if (!isInit) |
| | | if (null != blocker && effectConfig != null) |
| | | { |
| | | if (BattleConst.UnactiveHeroSortingOrder == heroSetedSortingOrder) |
| | | { |
| | | InitComponent(showLog); |
| | | isInit = true; |
| | | so = effectConfig.frontBack == 1 ? BattleConst.UnactiveHeroFrontSortingOrder : BattleConst.UnactiveHeroBackSortingOrder; |
| | | } |
| | | else |
| | | { |
| | | //避免重复创建 |
| | | if (!this.gameObject.activeSelf) |
| | | { |
| | | this.gameObject.SetActive(true); |
| | | } |
| | | return; |
| | | so = effectConfig.frontBack == 1 ? BattleConst.ActiveHeroFrontSortingOrder : BattleConst.ActiveHeroBackSortingOrder; |
| | | } |
| | | |
| | | blocker.SetSortingOrder(so); |
| | | } |
| | | } |
| | | |
| | | public virtual void Play(bool showLog = true) |
| | | { |
| | | if (!isInit) |
| | | { |
| | | InitComponent(showLog); |
| | | isInit = true; |
| | | } |
| | | else |
| | | { |
| | | //避免重复创建 |
| | | if (!this.gameObject.activeSelf) |
| | | { |
| | | this.gameObject.SetActive(true); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (EffectMgr.IsNotShowBySetting(effectId)) |
| | | { |
| | |
| | | |
| | | if (effectConfig.autoDestroy != 0) |
| | | { |
| | | GameObject.Destroy(gameObject, effectConfig.destroyDelay); |
| | | GameObject.Destroy(gameObject, effectConfig.destroyDelay / speedRate); |
| | | } |
| | | |
| | | |
| | | PlayEffect(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | spineAnimationState.Complete -= OnSpineAnimationComplete; |
| | | spineAnimationState.Complete += OnSpineAnimationComplete; |
| | | |
| | | |
| | | if (null == canvas) |
| | | canvas = GetComponentInParent<Canvas>(); |
| | | |
| | | // 添加特效穿透阻挡器 |
| | | blocker = spineComp.AddMissingComponent<EffectPenetrationBlocker>(); |
| | | blocker = spineComp.AddMissingComponent<RendererAdjuster>(); |
| | | |
| | | blocker.onSortingChanged = OnSortingChanged; |
| | | |
| | | // 如果没有canvas的话 正常是因为不在BattleWin下面的节点 意思就是当前没有显示 等到切回战斗的时候再通过BattleField.UpdateCanvas来更新 |
| | | if (canvas != null) |
| | | { |
| | | blocker.SetParentCanvas(canvas); |
| | | } |
| | | |
| | | spineComp.enabled = true; |
| | | |
| | | spineComp.timeScale = speedRate; |
| | | spineAnimationState.TimeScale = speedRate; |
| | | |
| | | Spine.Animation animation = spineAnimationState.Data.SkeletonData.Animations.First(); |
| | | spineAnimationState.SetAnimation(0, animation, effectConfig.isLoop != 0); |
| | |
| | | |
| | | OnUnityAnimationComplete(); |
| | | |
| | | if (null == canvas) |
| | | canvas = GetComponentInParent<Canvas>(); |
| | | |
| | | // 添加特效穿透阻挡器 |
| | | blocker = effectTarget.AddMissingComponent<EffectPenetrationBlocker>(); |
| | | blocker = effectTarget.AddMissingComponent<RendererAdjuster>(); |
| | | |
| | | blocker.onSortingChanged = OnSortingChanged; |
| | | |
| | | // 如果没有canvas的话 正常是因为不在BattleWin下面的节点 意思就是当前没有显示 等到切回战斗的时候再通过BattleField.UpdateCanvas来更新 |
| | | if (canvas != null) |
| | | { |
| | | blocker.SetParentCanvas(canvas); |
| | | } |
| | | |
| | | SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置遮罩(支持RectMask2D、Mask、SmoothMask等) |
| | | /// </summary> |
| | | public void SetMask(RectTransform maskArea = null) |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | if (effectTarget == null || blocker == null) |
| | | return; |
| | | |
| | | // 优先使用传入的maskArea |
| | | if (maskArea != null) |
| | | speedRate = ratio; |
| | | if (spineComp != null) |
| | | { |
| | | blocker.PerformMask(maskArea); |
| | | return; |
| | | spineComp.timeScale = speedRate; |
| | | } |
| | | |
| | | // Animator动画 |
| | | foreach (var animator in animatorList) |
| | | { |
| | | animator.speed = speedRate; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public BattleEffectPlayer PlayEffect(int ObjID, int effectId, Transform parent, BattleCamp camp) |
| | | public BattleEffectPlayer PlayEffect(BattleObject layerDepender, int effectId, Transform parent, BattleCamp camp) |
| | | { |
| | | if (effectId <= 0) |
| | | { |
| | |
| | | |
| | | effectPlayer.transform.position = parent.position; |
| | | |
| | | effectPlayer.onDestroy += OnEffectDestroy; |
| | | |
| | | BattleObject temp = layerDepender; |
| | | effectPlayer.onDestroy += (efPlayer) => |
| | | { |
| | | OnEffectDestroy(efPlayer); |
| | | temp.layerMgr.RemoveEffect(efPlayer); |
| | | }; |
| | | |
| | | if (effectPlayer != null) |
| | | { |
| | | effectDict[effectId].Add(effectPlayer); |
| | | } |
| | | effectPlayer.Play(true); |
| | | |
| | | effectPlayer.SetSpeedRatio(battleField.speedRatio); |
| | | |
| | | var effectScale = effectPlayer.transform.localScale; |
| | | effectScale.x *= isRedCamp ? 1 : -1; |
| | | effectPlayer.transform.localScale = effectScale; |
| | | |
| | | if (null != layerDepender) |
| | | { |
| | | layerDepender.layerMgr.AddEffect(effectPlayer); |
| | | } |
| | | |
| | | return effectPlayer; |
| | | } |
| | |
| | | |
| | | effectDict.Clear(); |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | foreach (var kvPair in effectDict) |
| | | { |
| | | foreach (var effectPlayer in kvPair.Value) |
| | | { |
| | | effectPlayer.SetSpeedRatio(ratio); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public int FuncLineID = 0; |
| | | |
| | | public float speedRatio = 1.1f; |
| | | |
| | | public JsonData extendData; |
| | | |
| | | public bool IsBattleFinish |
| | |
| | | battleTweenMgr = new BattleTweenMgr(); |
| | | recordPlayer = new RecordPlayer(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public virtual void Init(int _MapID, int _FuncLineID, JsonData _extendData, |
| | |
| | | battleEffectMgr.Init(this); |
| | | battleTweenMgr.Init(this); |
| | | recordPlayer.Init(this); |
| | | |
| | | |
| | | if (blueTeamList == null) |
| | | { |
| | | battleObjMgr.Init(this, redTeamList[redTeamIndex], null); |
| | |
| | | battleObjMgr.Init(this, redTeamList[redTeamIndex], blueTeamList[blueTeamIndex]); |
| | | } |
| | | |
| | | battleRootNode.SetBackground(ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", "battlebg1")); |
| | | battleRootNode.SetBackground(ResManager.Instance.LoadAsset<Texture>("Texture/FullScreenBg", "mainui_img_277")); |
| | | |
| | | SetBattleStartState(); |
| | | SetSpeedRatio(speedRatio); |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | speedRatio = ratio; |
| | | battleObjMgr.SetSpeedRatio(ratio); |
| | | recordPlayer.SetSpeedRatio(ratio); |
| | | battleEffectMgr.SetSpeedRatio(ratio); |
| | | battleTweenMgr.SetSpeedRatio(ratio); |
| | | } |
| | | |
| | | protected virtual void SetBattleStartState() |
| | | { |
| | | foreach (var obj in battleObjMgr.allBattleObjDict.Values) |
| | | { |
| | | obj.layerMgr.SetFront(); |
| | | } |
| | | |
| | | battleRootNode.skillMaskNode.SetActive(false); |
| | | } |
| | | |
| | | // 在Run之前要设置完毕 要创建Agent |
| | |
| | | |
| | | public void UpdateCanvas(Canvas canvas) |
| | | { |
| | | EffectPenetrationBlocker[] blockers = battleRootNode.GetComponentsInChildren<EffectPenetrationBlocker>(true); |
| | | |
| | | if (null != blockers) |
| | | foreach (var obj in battleObjMgr.allBattleObjDict.Values) |
| | | { |
| | | foreach (var blocker in blockers) |
| | | { |
| | | blocker.SetParentCanvas(canvas); |
| | | } |
| | | obj.layerMgr.UpdateLayer(); |
| | | } |
| | | |
| | | // RendererAdjuster[] adjusters = battleRootNode.GetComponentsInChildren<RendererAdjuster>(true); |
| | |
| | | // imgBackground.SetNativeSize(); |
| | | } |
| | | } |
| | | |
| | | public Transform skillBackNode; |
| | | |
| | | public Transform skillFrontNode; |
| | | |
| | | public GameObject skillMaskNode; |
| | | } |
| | |
| | | private bool isRun = false; |
| | | |
| | | public DodgeFinishAction(BattleField _battleField, BattleObject _dodgeObj) |
| | | : base(RecordActionType.DodgeFinish, _battleField, null) |
| | | : base(RecordActionType.DodgeFinish, _battleField, _dodgeObj) |
| | | { |
| | | |
| | | } |
| | |
| | | battleObj.heroGo.SetActive(active); |
| | | allBattleObjDict.Add(battleObj.ObjID, battleObj); |
| | | campDict.Add(teamHero.positionNum, battleObj); |
| | | battleObj.SetSpeedRatio(battleField.speedRatio); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | foreach (var obj in allBattleObjDict.Values) |
| | | { |
| | | obj.SetSpeedRatio(ratio); |
| | | } |
| | | } |
| | | |
| | | #if UNITY_EDITOR_STOP_USING |
| | | public void ReviveAll() |
| | | { |
| | |
| | | |
| | | public BattleObjectBuffMgr buffMgr; |
| | | |
| | | public BattleObjectLayerMgr layerMgr; |
| | | |
| | | public int ObjID { get; set; } |
| | | |
| | | public BattleCamp Camp { get; protected set; } |
| | |
| | | } |
| | | } |
| | | |
| | | public int sortingOrder = 0; |
| | | |
| | | protected Action onDeathAnimationComplete; |
| | | |
| | | protected Renderer[] renderers; |
| | |
| | | buffMgr = new BattleObjectBuffMgr(); |
| | | buffMgr.Init(this); |
| | | |
| | | layerMgr = new BattleObjectLayerMgr(); |
| | | layerMgr.Init(this); |
| | | |
| | | renderers = heroGo.GetComponentsInChildren<Renderer>(true); |
| | | |
| | | heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true); |
| | |
| | | heroInfoBar.transform.localScale = heroInfoBarScale; |
| | | |
| | | heroInfoBar.SetActive(true); |
| | | SetToFront(); |
| | | SetFront(); |
| | | } |
| | | |
| | | |
| | |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | |
| | | heroInfoBar.SetActive(false); |
| | | SetToFront(); |
| | | SetFront(); |
| | | } |
| | | |
| | | public void PushDropItems(BattleDrops _battleDrops) |
| | |
| | | battleDrops = null; |
| | | } |
| | | |
| | | public void SetToBack() |
| | | public void SetBack() |
| | | { |
| | | sortingOrder = BattleConst.UnactiveHeroSortingOrder; |
| | | UpdateSortingOrder(); |
| | | layerMgr.SetBack(); |
| | | } |
| | | |
| | | public void SetToFront() |
| | | public void SetFront() |
| | | { |
| | | sortingOrder = BattleConst.ActiveHeroSortingOrder; |
| | | UpdateSortingOrder(); |
| | | layerMgr.SetFront(); |
| | | } |
| | | |
| | | private void UpdateSortingOrder() |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | if (null == renderers) return; |
| | | |
| | | foreach (var renderer in renderers) |
| | | { |
| | | if (renderer != null) |
| | | { |
| | | renderer.sortingOrder = sortingOrder; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public int GetSortingOrder() |
| | | { |
| | | return sortingOrder; |
| | | motionBase.SetSpeedRatio(ratio); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections.Generic; |
| | | |
| | | public class BattleObjectLayerMgr |
| | | { |
| | | public BattleObject battleObj; |
| | | |
| | | public RendererAdjuster rendererAdjuster; |
| | | |
| | | private List<BattleEffectPlayer> effectPlayers = new List<BattleEffectPlayer>(); |
| | | |
| | | private bool isFront = true; |
| | | |
| | | public BattleObjectLayerMgr() |
| | | { |
| | | |
| | | } |
| | | |
| | | public void Init(BattleObject battleObj) |
| | | { |
| | | this.battleObj = battleObj; |
| | | rendererAdjuster = battleObj.heroGo.AddMissingComponent<RendererAdjuster>(); |
| | | } |
| | | |
| | | public void SetSortingOrder(int sortingOrder) |
| | | { |
| | | if (rendererAdjuster != null) |
| | | { |
| | | rendererAdjuster.SetSortingOrder(sortingOrder); |
| | | } |
| | | } |
| | | |
| | | public void AddEffect(BattleEffectPlayer effectPlayer) |
| | | { |
| | | if (effectPlayer != null && !effectPlayers.Contains(effectPlayer)) |
| | | { |
| | | effectPlayers.Add(effectPlayer); |
| | | effectPlayer.SetSortingOrder(rendererAdjuster.sortingOrder); |
| | | } |
| | | } |
| | | |
| | | public void RemoveEffect(BattleEffectPlayer effectPlayer) |
| | | { |
| | | if (effectPlayers.Contains(effectPlayer)) |
| | | { |
| | | effectPlayers.Remove(effectPlayer); |
| | | } |
| | | } |
| | | |
| | | public void SetFront() |
| | | { |
| | | isFront = true; |
| | | UpdateLayer(); |
| | | } |
| | | |
| | | public void SetBack() |
| | | { |
| | | isFront = false; |
| | | UpdateLayer(); |
| | | } |
| | | |
| | | public void UpdateLayer() |
| | | { |
| | | int order = isFront ? BattleConst.ActiveHeroSortingOrder : BattleConst.UnactiveHeroSortingOrder; |
| | | SetSortingOrder(order); |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9ccc1a52c3950a947a9159df13b88948 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | { |
| | | private BattleField battleField; |
| | | |
| | | private float speedRatio => battleField.speedRatio; |
| | | |
| | | private List<Tween> tweenList = new List<Tween>(); |
| | | |
| | | public void Init(BattleField _battleField) |
| | |
| | | } |
| | | |
| | | tweenList.Add(tween); |
| | | tween.timeScale = speedRatio; |
| | | tween.onComplete += () => |
| | | { |
| | | tweenList.Remove(tween); |
| | |
| | | } |
| | | tweenList.Clear(); |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | foreach (var tween in tweenList) |
| | | { |
| | | if (tween != null && !tween.IsComplete()) |
| | | { |
| | | tween.timeScale = speedRatio; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject.ObjID, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | effectDict.Add(skillConfig.EffectId, effect); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | effectDict = new Dictionary<int, BattleEffectPlayer>(); |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject.ObjID, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject, skillConfig.EffectId, battleObject.heroRectTrans, battleObject.Camp); |
| | | effectDict.Add(skillConfig.EffectId, effect); |
| | | buffEffectDict.Add(vNetData.BuffID, effectDict); |
| | | } |
| | |
| | | PlayAnimation(MotionName.idle, true); |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | MotionTimeScale = ratio; |
| | | spineAnimationState.TimeScale = ratio; |
| | | skeletonGraphic.timeScale = ratio; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | |
| | | |
| | | private bool isWaitingNextAction = false; |
| | | private float waitTimer = 0f; |
| | | private const float waitInterval = 0f; |
| | | private const float waitInterval = 0.2f; |
| | | |
| | | private float speedRatio = 1.5f; |
| | | |
| | | public void Init(BattleField _battleField) |
| | | { |
| | |
| | | // 等待下一个action |
| | | if (isWaitingNextAction) |
| | | { |
| | | waitTimer += Time.deltaTime; |
| | | waitTimer += Time.deltaTime * speedRatio; |
| | | if (waitTimer >= waitInterval) |
| | | { |
| | | isWaitingNextAction = false; |
| | |
| | | recordActionQueue.Clear(); |
| | | immediatelyActionList.Clear(); |
| | | } |
| | | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | speedRatio = ratio; |
| | | } |
| | | } |
| | |
| | | // battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | | |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null) |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 500f) |
| | | { |
| | | // 原地释放 |
| | | if (skillConfig.CastDistance >= 9999) |
| | |
| | | { |
| | | caster.motionBase.PlayAnimation(MotionName.idle, true); |
| | | _onComplete?.Invoke(); |
| | | }); |
| | | }, speed); |
| | | battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | | |
| | |
| | | { |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, |
| | | OnAttackFinish); |
| | | OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | { |
| | | RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum); |
| | | // 回到原来的位置 |
| | | MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish); |
| | | MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | { |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), |
| | | Vector2.zero, OnAttackFinish); |
| | | Vector2.zero, OnAttackFinish, 750F); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | |
| | | protected void HighLightAllTargets() |
| | | { |
| | | if (skillConfig.FuncType != 2) |
| | | return; |
| | | |
| | | // 高亮所有目标 |
| | | List<BattleObject> highlightList = battleField.battleObjMgr.GetBattleObjList(tagUseSkillAttack); |
| | | highlightList.Add(caster); |
| | |
| | | BattleObject bo = allList[i]; |
| | | if (highlightList.Contains(bo)) |
| | | { |
| | | bo.SetToFront(); |
| | | bo.layerMgr.SetFront(); |
| | | bo.heroRectTrans.SetParent(battleField.battleRootNode.skillFrontNode, true); |
| | | } |
| | | else |
| | | { |
| | | bo.SetToBack(); |
| | | bo.layerMgr.SetBack(); |
| | | bo.heroRectTrans.SetParent(battleField.battleRootNode.skillBackNode, true); |
| | | } |
| | | } |
| | | |
| | | // battleField.skillMask.SetActive(true); |
| | | battleField.battleRootNode.skillMaskNode.SetActive(true); |
| | | |
| | | // caster.battleField.skillMask |
| | | // 把这些BO全高亮 或者说把除了这些的都放在遮罩后面 |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | battleField.battleRootNode.skillMaskNode.SetActive(false); |
| | | |
| | | |
| | | |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public virtual void ForceFinished() |
| | |
| | | private void ShotToIndex(BattleCamp camp, int targetIndex, int bulletIndex) |
| | | { |
| | | RectTransform targetTransform = caster.battleField.GetTeamNode(camp, targetIndex); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | |
| | | RectTransform effectTrans = effectPlayer.transform as RectTransform; |
| | | |
| | |
| | | |
| | | protected void ShotToTarget(BattleObject target, int bulletIndex) |
| | | { |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp); |
| | | |
| | | var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, bulletIndex, (index, hitList) => |
| | | { |
| | |
| | | if (effectId <= 0) |
| | | return; |
| | | |
| | | var effect = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, effectId, parent, camp); |
| | | var effect = caster.battleField.battleEffectMgr.PlayEffect(caster, effectId, parent, camp); |
| | | if (effect != null) |
| | | { |
| | | effect.transform.localRotation = parent.localRotation; |
| | |
| | | |
| | | if (skillConfig.ExplosionEffectId > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplosionEffectId, targetTransform, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.ExplosionEffectId, targetTransform, caster.Camp); |
| | | } |
| | | |
| | | if (skillConfig.ExplosionEffect2 > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplosionEffect2, targetTransform, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.ExplosionEffect2, targetTransform, caster.Camp); |
| | | } |
| | | |
| | | for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++) |
| | |
| | | |
| | | if (skillConfig.ExplosionEffect3 > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(target.ObjID, skillConfig.ExplosionEffect3, target.heroGo.transform, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect3, target.heroGo.transform, caster.Camp); |
| | | } |
| | | } |
| | | |
| | |
| | | onHit = _onHit; |
| | | if (skillConfig.EffectId > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId, caster.heroRectTrans, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId, caster.heroRectTrans, caster.Camp); |
| | | } |
| | | if (skillConfig.EffectId2 > 0) |
| | | { |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId2, caster.heroRectTrans, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId2, caster.heroRectTrans, caster.Camp); |
| | | } |
| | | } |
| | | |
| | |
| | | if (skillConfig.MStartEffectId <= 0) |
| | | return; |
| | | // 中摇固定特效 |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.MStartEffectId, caster.heroGo.transform, caster.Camp); |
| | | caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.MStartEffectId, caster.heroGo.transform, caster.Camp); |
| | | } |
| | | |
| | | /// <summary> |