|  |  | 
 |  |  |  | 
 |  |  |     public BattleObjectBuffMgr buffMgr; | 
 |  |  |  | 
 |  |  |     public BattleObjectLayerMgr layerMgr; | 
 |  |  |  | 
 |  |  |     public int ObjID { get; set; } | 
 |  |  |  | 
 |  |  |     public BattleCamp Camp { get; protected set; } | 
 |  |  |  | 
 |  |  |     public TeamHero teamHero { get; protected set; } | 
 |  |  |  | 
 |  |  |     // public BuffMgr buffMgr; | 
 |  |  |  | 
 |  |  |     public MotionBase motionBase; | 
 |  |  |  | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public int sortingOrder = 0; | 
 |  |  |  | 
 |  |  |     protected Action onDeathAnimationComplete; | 
 |  |  |  | 
 |  |  |     protected Renderer[] renderers; | 
 |  |  | 
 |  |  |         teamHero = _teamHero; | 
 |  |  |         Camp = _camp; | 
 |  |  |         motionBase = new MotionBase(); | 
 |  |  |         motionBase.Init(heroGo.GetComponentInChildren<SkeletonGraphic>(true)); | 
 |  |  |         motionBase.Init(heroGo.GetComponentInChildren<SkeletonAnimation>(true)); | 
 |  |  |         buffMgr = new BattleObjectBuffMgr(); | 
 |  |  |         buffMgr.Init(this); | 
 |  |  |  | 
 |  |  |         layerMgr = new BattleObjectLayerMgr(); | 
 |  |  |         layerMgr.Init(this); | 
 |  |  |  | 
 |  |  |         renderers = heroGo.GetComponentsInChildren<Renderer>(true); | 
 |  |  |  | 
 |  |  | 
 |  |  |         heroInfoBar.transform.localScale = heroInfoBarScale; | 
 |  |  |  | 
 |  |  |         heroInfoBar.SetActive(true); | 
 |  |  |         SetToFront(); | 
 |  |  |         SetFront(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |     { | 
 |  |  |         motionBase.Run(); | 
 |  |  |         heroInfoBar.Run(); | 
 |  |  |         buffMgr.Run(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public virtual void Pause() | 
 |  |  | 
 |  |  |         return true; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) | 
 |  |  |     public virtual void Hurt(List<long> damageValues, long _totalDamage, | 
 |  |  |         HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig, int hitIndex, | 
 |  |  |         BattleDrops battleDrops, HB422_tagMCTurnFightObjDead deadPack) | 
 |  |  |     { | 
 |  |  |         BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig); | 
 |  |  |         bool isLastHit = hitIndex >= skillConfig.DamageDivide.Length - 1; | 
 |  |  |         bool firstHit = hitIndex == 0; | 
 |  |  |  | 
 |  |  |         if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()) | 
 |  |  |         //  这里 | 
 |  |  |         if (dmgInfo.IsType(DamageType.Dodge)) | 
 |  |  |         { | 
 |  |  |             motionBase.PlayAnimation(MotionName.hit, false); | 
 |  |  |             if (isLastHit) | 
 |  |  |             { | 
 |  |  |                 DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this); | 
 |  |  |                 battleField.recordPlayer.InsertRecord(dodgeFinish); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (firstHit) | 
 |  |  |             { | 
 |  |  |                 OnDodgeBegin(); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         bool isFatalAttack = (null != deadPack) && isLastHit; | 
 |  |  |  | 
 |  |  |         if (isFatalAttack) | 
 |  |  |         { | 
 |  |  |             if (null != battleDrops) | 
 |  |  |             { | 
 |  |  |                 PushDropItems(battleDrops); | 
 |  |  |             } | 
 |  |  |             battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { deadPack }); | 
 |  |  |              | 
 |  |  |         } | 
 |  |  |         else | 
 |  |  |         { | 
 |  |  |             if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage())) | 
 |  |  |             { | 
 |  |  |                 motionBase.PlayAnimation(MotionName.hit, false); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void SuckHp(uint suckHP, SkillConfig skillConfig) | 
 |  |  |     { | 
 |  |  |  | 
 |  |  |         teamHero.curHp = Math.Min(teamHero.maxHp, teamHero.curHp + (int)suckHP); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void HurtByReflect(uint bounceHP, SkillConfig skillConfig) | 
 |  |  |     { | 
 |  |  |  | 
 |  |  |         teamHero.curHp = Math.Max(0, teamHero.curHp - (int)bounceHP); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const float pingpongTime = 0.4f; | 
 |  |  |     //  闪避开始 | 
 |  |  |     public virtual void OnDodgeBegin() | 
 |  |  |     { | 
 |  |  |         float pingpongTime = 0.2f; | 
 |  |  |         RectTransform rectTrans = heroRectTrans; | 
 |  |  |         var tween = rectTrans.DOAnchorPos(new Vector3(-30, 0, 0), pingpongTime) | 
 |  |  |             .SetEase(Ease.OutCubic); | 
 |  |  |  | 
 |  |  |         motionBase.ShowIllusionShadow(true); | 
 |  |  |  | 
 |  |  |         tween.onComplete += () => | 
 |  |  |         { | 
 |  |  |             motionBase.ShowIllusionShadow(false); | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |         battleField.battleTweenMgr.OnPlayTween(tween); | 
 |  |  |     } | 
 |  |  | 
 |  |  |     //  闪避结束 | 
 |  |  |     public virtual void OnDodgeEnd(Action _complete = null) | 
 |  |  |     { | 
 |  |  |         float pingpongTime = 0.2f; | 
 |  |  |         RectTransform rectTrans = heroRectTrans; | 
 |  |  |  | 
 |  |  |         var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime) | 
 |  |  | 
 |  |  |     { | 
 |  |  |         //  或许看看溶解特效? YYL TODO | 
 |  |  |         heroGo.SetActive(false); | 
 |  |  |  | 
 |  |  |         buffMgr.RemoveAllBuff(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void OnReborn(HB423_tagMCTurnFightObjReborn vNetData) | 
 |  |  | 
 |  |  |     { | 
 |  |  |         BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig); | 
 |  |  |  | 
 |  |  |         if (battleDmgInfo.IsType(DamageType.Dodge)) | 
 |  |  |         { | 
 |  |  |             OnDodgeBegin(); | 
 |  |  |             DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this); | 
 |  |  |             battleField.recordPlayer.InsertRecord(dodgeFinish); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         int currentHurtHp = 0; | 
 |  |  |         for (int i = 0; i < damageValues.Count; i++) | 
 |  |  | 
 |  |  |             currentHurtHp += (int)damageValues[i]; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         heroInfoBar.UpdateHP(teamHero.curHp, Math.Max(0, teamHero.curHp - currentHurtHp), teamHero.maxHp); | 
 |  |  |         teamHero.curHp = Math.Max(0, teamHero.curHp - currentHurtHp); | 
 |  |  |         bool isRecovery = battleDmgInfo.IsType(DamageType.Recovery); | 
 |  |  |  | 
 |  |  |         long toHp = Math.Max(0, teamHero.curHp + (isRecovery ? currentHurtHp : -currentHurtHp)); | 
 |  |  |  | 
 |  |  |         heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp); | 
 |  |  |         teamHero.curHp = toHp; | 
 |  |  |  | 
 |  |  |         // YYL TODO 是否需要挂在在自身的follow点上 | 
 |  |  |         EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); | 
 |  |  | 
 |  |  |         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); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  |