| | |
| | | private set; |
| | | } |
| | | |
| | | private RectTransform m_heroRectTrans; |
| | | |
| | | public RectTransform heroRectTrans |
| | | { |
| | | get |
| | | { |
| | | if (m_heroRectTrans == null) |
| | | { |
| | | m_heroRectTrans = heroGo.GetComponent<RectTransform>(); |
| | | } |
| | | return m_heroRectTrans; |
| | | } |
| | | } |
| | | |
| | | protected Action onDeathAnimationComplete; |
| | | |
| | | protected Renderer[] renderers; |
| | | |
| | | public Transform effectNode; |
| | | |
| | | private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>(); |
| | | |
| | | public BattleObject(BattleField _battleField) |
| | | { |
| | |
| | | motionBase = new MotionBase(); |
| | | motionBase.Init(heroGo.GetComponentInChildren<SkeletonGraphic>(true)); |
| | | motionBase.onAnimationComplete += OnAnimationComplete; |
| | | |
| | | buffMgr = new BattleObjectBuffMgr(); |
| | | buffMgr.Init(this); |
| | | |
| | | renderers = heroGo.GetComponentsInChildren<Renderer>(true); |
| | |
| | | |
| | | public virtual void Destroy() |
| | | { |
| | | if (heroGo != null) |
| | | { |
| | | GameObject.DestroyImmediate(heroGo); |
| | | heroGo = null; |
| | | } |
| | | |
| | | motionBase.onAnimationComplete -= OnAnimationComplete; |
| | | |
| | | motionBase.Release(); |
| | | motionBase = null; |
| | | teamHero = null; |
| | | ObjID = 0; |
| | | motionBase.onAnimationComplete -= OnAnimationComplete; |
| | | |
| | | if (heroGo != null) |
| | | { |
| | | GameObject.DestroyImmediate(heroGo); |
| | | heroGo = null; |
| | | } |
| | | } |
| | | |
| | | public void OnObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo) |
| | |
| | | return true; |
| | | } |
| | | |
| | | public virtual void Hurt(List<long> damageValues, int attackType) |
| | | public virtual void Hurt(List<long> damageValues, long _totalDamage, uint attackType) |
| | | { |
| | | PopDamage(teamHero.curHp, damageValues, attackType); |
| | | |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | |
| | | // 计算伤害 |
| | | long totalDamage = 0; |
| | | foreach (var damage in damageValues) |
| | | { |
| | | totalDamage += damage; |
| | | } |
| | | |
| | | // 扣血 |
| | | teamHero.curHp -= totalDamage; |
| | | teamHero.curHp -= _totalDamage; |
| | | } |
| | | |
| | | // 闪避开始 |
| | | public virtual void OnDodgeBegin() |
| | | { |
| | | float pingpongTime = 0.2f; |
| | | RectTransform rectTrans = heroGo.GetComponent<RectTransform>(); |
| | | RectTransform rectTrans = heroRectTrans; |
| | | var tween = rectTrans.DOAnchorPos(new Vector3(-50, 50, 0), pingpongTime) |
| | | .SetEase(Ease.OutCubic); |
| | | |
| | |
| | | public virtual void OnDodgeEnd() |
| | | { |
| | | float pingpongTime = 0.2f; |
| | | RectTransform rectTrans = heroGo.GetComponent<RectTransform>(); |
| | | RectTransform rectTrans = heroRectTrans; |
| | | |
| | | var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime) |
| | | .SetEase(Ease.OutCubic); |
| | |
| | | heroGo.SetActive(false); |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual void PopDamage(long curHp, List<long> damageValues, int attackType) |
| | | public void OnReborn(HB423_tagMCTurnFightObjReborn vNetData) |
| | | { |
| | | // 处理复活逻辑 |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.HP, vNetData.HPEx); |
| | | heroGo.SetActive(true); |
| | | motionBase.PlayAnimation(MotionName.idle, true); |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual void PopDamage(long curHp, List<long> damageValues, uint attackType) |
| | | { |
| | | // 其实应该通知出去给UI界面解耦 让UI界面自己来显示的 YYL TODO |
| | | // 播放伤害数字 |
| | |
| | | Debug.Log($"Damage: {damage}"); |
| | | } |
| | | |
| | | // YYL TODO 是否需要挂在在自身的follow点上 |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleField.guid, this, damageValues); |
| | | } |
| | | |
| | |
| | | return battleField.GetTeamNode(Camp == BattleCamp.Red ? BattleCamp.Blue : BattleCamp.Red); |
| | | } |
| | | |
| | | public BattleCamp GetEnemyCamp() |
| | | { |
| | | return Camp == BattleCamp.Red ? BattleCamp.Blue : BattleCamp.Red; |
| | | } |
| | | |
| | | public void HaveRest() |
| | | { |
| | | // YYL TODO |
| | | // 休息状态 |
| | | // 多一个zzz的一个特效 |
| | | |
| | | motionBase.PlayAnimation(MotionName.idle, true); |
| | | } |
| | | |
| | | public void PushExpPackList(List<HB405_tagMCAddExp> _hB405_tagMCAddExps) |
| | | { |
| | | // YYL TODO 死亡后弹出经验掉落提醒 |
| | | hB405_tagMCAddExps = _hB405_tagMCAddExps; |
| | | } |
| | | |
| | | public void DropExp() |
| | | { |
| | | // YYL TODO |
| | | // hB405_tagMCAddExps |
| | | } |
| | | |
| | | |
| | | |
| | | #if UNITY_EDITOR_STOP_USING |
| | | public void EditorRevive() |
| | | { |