| | |
| | | private set; |
| | | } |
| | | |
| | | protected BattleDrops battleDrops; |
| | | |
| | | 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 BattleHeroInfoBar heroInfoBar; |
| | | |
| | | public BattleObject(BattleField _battleField) |
| | | { |
| | |
| | | buffMgr.Init(this); |
| | | |
| | | renderers = heroGo.GetComponentsInChildren<Renderer>(true); |
| | | } |
| | | |
| | | heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true); |
| | | heroInfoBar.SetBattleObject(this); |
| | | |
| | | // 根据阵营翻转血条 |
| | | var heroInfoBarScale = heroInfoBar.transform.localScale; |
| | | heroInfoBarScale.x *= Camp == BattleCamp.Red ? 1 : -1; |
| | | heroInfoBar.transform.localScale = heroInfoBarScale; |
| | | |
| | | } |
| | | |
| | | |
| | | public virtual void Run() |
| | | { |
| | | motionBase.Run(); |
| | | heroInfoBar.Run(); |
| | | } |
| | | |
| | | public virtual void Pause() |
| | |
| | | |
| | | 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) |
| | |
| | | switch ((PlayerDataType)_refreshInfo.RefreshType) |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp); |
| | | teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | | teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | break; |
| | | case PlayerDataType.XP: |
| | | long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.rage, toXp, 100); |
| | | teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | break; |
| | | default: |
| | |
| | | return true; |
| | | } |
| | | |
| | | public virtual void Hurt(List<long> damageValues, int attackType) |
| | | public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | { |
| | | PopDamage(teamHero.curHp, damageValues, attackType); |
| | | PopDamage(damageValues, hurt, skillConfig); |
| | | |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | |
| | | // 计算伤害 |
| | | long totalDamage = 0; |
| | | foreach (var damage in damageValues) |
| | | { |
| | | totalDamage += damage; |
| | | } |
| | | // 扣血流给别的敌方刷新好了 |
| | | teamHero.curHp -= _totalDamage; |
| | | } |
| | | |
| | | // 扣血 |
| | | teamHero.curHp -= totalDamage; |
| | | public void SuckHp(uint suckHP, SkillConfig skillConfig) |
| | | { |
| | | |
| | | } |
| | | |
| | | public void HurtByReflect(uint bounceHP, SkillConfig skillConfig) |
| | | { |
| | | |
| | | } |
| | | |
| | | // 闪避开始 |
| | | 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); |
| | |
| | | motionBase.PlayAnimation(MotionName.dead, false); |
| | | } |
| | | |
| | | protected virtual void OnAnimationComplete(MotionName motionName) |
| | | protected virtual void OnAnimationComplete(string motionName) |
| | | { |
| | | if (motionName == MotionName.dead) |
| | | if (motionName == MotionName.dead.ToString().ToLower()) |
| | | { |
| | | OnDeadAnimationComplete(); |
| | | onDeathAnimationComplete?.Invoke(); |
| | |
| | | heroGo.SetActive(false); |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual void PopDamage(long curHp, List<long> damageValues, int attackType) |
| | | public void OnReborn(HB423_tagMCTurnFightObjReborn vNetData) |
| | | { |
| | | // 其实应该通知出去给UI界面解耦 让UI界面自己来显示的 YYL TODO |
| | | // 播放伤害数字 |
| | | // 这里可以实现一个伤害数字的弹出效果 |
| | | // 比如使用一个UI组件来显示伤害数字 |
| | | foreach (var damage in damageValues) |
| | | { |
| | | Debug.Log($"Damage: {damage}"); |
| | | } |
| | | // 处理复活逻辑 |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.HP, vNetData.HPEx); |
| | | heroGo.SetActive(true); |
| | | motionBase.PlayAnimation(MotionName.idle, true); |
| | | } |
| | | |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleField.guid, this, damageValues); |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual void PopDamage(List<long> damageValues, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | { |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig); |
| | | |
| | | // YYL TODO 是否需要挂在在自身的follow点上 |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); |
| | | } |
| | | |
| | | public RectTransform GetAliasTeamNode() |
| | |
| | | // YYL TODO |
| | | // 休息状态 |
| | | // 多一个zzz的一个特效 |
| | | heroGo.SetActive(true); |
| | | motionBase.PlayAnimation(MotionName.idle, true); |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | } |
| | | |
| | | public void PushDropItems(BattleDrops _battleDrops) |
| | | { |
| | | battleDrops = _battleDrops; |
| | | } |
| | | |
| | | public void PerformDrop() |
| | | { |
| | | if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0) |
| | | return; |
| | | |
| | | EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>( |
| | | EventName.BATTLE_DROP_ITEMS, battleField.guid, battleDrops, OnPerformDropFinish); |
| | | } |
| | | |
| | | protected void OnPerformDropFinish() |
| | | { |
| | | battleDrops = null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #if UNITY_EDITOR_STOP_USING |
| | | public void EditorRevive() |
| | | { |