| | |
| | | private set; |
| | | } |
| | | |
| | | protected BattleDrops battleDrops; |
| | | protected BattleDrops m_battleDrops; |
| | | |
| | | private RectTransform m_heroRectTrans; |
| | | |
| | |
| | | buffMgr = new BattleObjectBuffMgr(); |
| | | buffMgr.Init(this); |
| | | |
| | | buffMgr.onIsControlChanged += OnControledChange; |
| | | |
| | | layerMgr = new BattleObjectLayerMgr(); |
| | | layerMgr.Init(this); |
| | | |
| | |
| | | var heroInfoBarScale = heroInfoBar.transform.localScale; |
| | | heroInfoBarScale.x *= Camp == BattleCamp.Red ? 1 : -1; |
| | | heroInfoBar.transform.localScale = heroInfoBarScale; |
| | | |
| | | heroInfoBar.SetActive(true); |
| | | if (battleField is StoryBattleField && (battleField as StoryBattleField).battleState == StoryBattleState.Break) |
| | | { |
| | | //主线关卡休息中的不显示血条 |
| | | heroInfoBar.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | heroInfoBar.SetActive(true); |
| | | } |
| | | SetFront(); |
| | | } |
| | | |
| | |
| | | |
| | | motionBase.Release(); |
| | | motionBase = null; |
| | | buffMgr.onIsControlChanged -= OnControledChange; |
| | | buffMgr.Release(); |
| | | buffMgr = null; |
| | | teamHero = null; |
| | | ObjID = 0; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 有变化了才会调用这个函数 |
| | | private void OnControledChange(int groupType, bool value) |
| | | { |
| | | // 这里是受到硬控时候 需要表现的动画 |
| | | if (groupType == BattleConst.HardControlGroup) |
| | | { |
| | | // 从没被硬控到被硬控 |
| | | if (value) |
| | | { |
| | | motionBase.SetControledAnimation(); |
| | | } |
| | | else |
| | | { |
| | | motionBase.CancelControledAnimation(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void OnObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo) |
| | | { |
| | | // 天子的挑战拦截血条,不拦截怒气 |
| | | BattleObject boss = battleField.FindBoss(); |
| | | if (boss != null && battleField.MapID == 30020 && boss.ObjID == _refreshInfo.ObjID && _refreshInfo.RefreshType != (ushort)PlayerDataType.XP) |
| | | return; |
| | | switch ((PlayerDataType)_refreshInfo.RefreshType) |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false); |
| | | teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | | teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false); |
| | | break; |
| | | case PlayerDataType.XP: |
| | | long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | |
| | | |
| | | public void ObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData) |
| | | { |
| | | // 天子的挑战拦截血条,不拦截怒气 |
| | | BattleObject boss = battleField.FindBoss(); |
| | | if (boss != null && battleField.MapID == 30020 && boss.ObjID == vNetData.ObjID && vNetData.RefreshType != (ushort)PlayerDataType.XP) |
| | | return; |
| | | switch ((PlayerDataType)vNetData.RefreshType) |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false); |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | | teamHero.maxHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false); |
| | | break; |
| | | case PlayerDataType.XP: |
| | | long toXp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx); |
| | |
| | | return true; |
| | | } |
| | | |
| | | public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig, bool playAnimation = true) |
| | | public virtual void Hurt(BattleHurtParam battleHurtParam) |
| | | { |
| | | BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig); |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1; |
| | | bool firstHit = battleHurtParam.hitIndex == 0; |
| | | BattleDmgInfo dmgInfo = PopDamage(battleHurtParam); |
| | | |
| | | if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()) && playAnimation) |
| | | |
| | | // 这里 |
| | | if (dmgInfo.IsType(DamageType.Dodge) && !buffMgr.isControled[BattleConst.HardControlGroup]) |
| | | { |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | if (isLastHit) |
| | | { |
| | | DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this); |
| | | battleField.recordPlayer.InsertRecord(dodgeFinish); |
| | | } |
| | | |
| | | if (firstHit) |
| | | { |
| | | OnDodgeBegin(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | bool isFatalAttack = (null != battleHurtParam.deadPack) && isLastHit; |
| | | |
| | | if (isFatalAttack) |
| | | { |
| | | if (null != battleHurtParam.battleDrops) |
| | | { |
| | | PushDropItems(battleHurtParam.battleDrops); |
| | | } |
| | | battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack }); |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (dmgInfo.IsType(DamageType.Block)) |
| | | { |
| | | battleField.battleEffectMgr.PlayEffect(this, 19999, heroRectTrans, Camp); |
| | | } |
| | | else |
| | | { |
| | | if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage())) |
| | | { |
| | | if (!buffMgr.isControled[BattleConst.HardControlGroup]) |
| | | { |
| | | 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); |
| | | |
| | | DamageNumConfig damageNumConfig = DamageNumConfig.Get((int)DamageType.Dodge); |
| | | |
| | | string dodgeStr = ((char)damageNumConfig.prefix).ToString(); |
| | | |
| | | heroInfoBar.ShowTips(dodgeStr, true, false); |
| | | |
| | | 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) |
| | |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual BattleDmgInfo PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | protected virtual BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam) |
| | | { |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig); |
| | | |
| | | if (battleDmgInfo.IsType(DamageType.Dodge)) |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam); |
| | | // 天子的挑战拦截血条逻辑 |
| | | BattleObject boss = battleField.FindBoss(); |
| | | if (boss != null && battleField.MapID == 30020 && boss.ObjID == battleHurtParam.hurtObj.ObjID) |
| | | { |
| | | OnDodgeBegin(); |
| | | DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this); |
| | | battleField.recordPlayer.InsertRecord(dodgeFinish); |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); |
| | | return battleDmgInfo; |
| | | } |
| | | else |
| | | { |
| | | heroInfoBar.UpdateDamage(battleDmgInfo); |
| | | |
| | | // YYL TODO 是否需要挂在在自身的follow点上 |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); |
| | | return battleDmgInfo; |
| | | } |
| | | |
| | | int currentHurtHp = 0; |
| | | for (int i = 0; i < damageValues.Count; i++) |
| | | { |
| | | currentHurtHp += (int)damageValues[i]; |
| | | } |
| | | |
| | | 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); |
| | | return battleDmgInfo; |
| | | } |
| | | |
| | | public RectTransform GetAliasTeamNode() |
| | |
| | | |
| | | public void PushDropItems(BattleDrops _battleDrops) |
| | | { |
| | | battleDrops = _battleDrops; |
| | | m_battleDrops = _battleDrops; |
| | | } |
| | | |
| | | public void PerformDrop() |
| | | { |
| | | if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0) |
| | | if (null == m_battleDrops) |
| | | return; |
| | | |
| | | EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>( |
| | | EventName.BATTLE_DROP_ITEMS, battleField.guid, battleDrops, OnPerformDropFinish); |
| | | EventName.BATTLE_DROP_ITEMS, battleField.guid, m_battleDrops, OnPerformDropFinish); |
| | | } |
| | | |
| | | protected void OnPerformDropFinish() |
| | | { |
| | | battleDrops = null; |
| | | m_battleDrops = null; |
| | | } |
| | | |
| | | public void SetBack() |
| | |
| | | public void SetSpeedRatio(float ratio) |
| | | { |
| | | motionBase.SetSpeedRatio(ratio); |
| | | heroInfoBar.SetSpeedRatio(ratio); |
| | | } |
| | | |
| | | |