| | |
| | | private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>(); |
| | | public BattleHeroInfoBar heroInfoBar; |
| | | |
| | | public bool isReborning = false; |
| | | |
| | | public BattleObject(BattleField _battleField) |
| | | { |
| | | battleField = _battleField; |
| | |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false); |
| | | if (!IsTianziBoss()) |
| | | { |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false); |
| | | } |
| | | teamHero.curHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | // Debug.LogError("OnObjInfoRefresh " + teamHero.curHp); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | | teamHero.maxHp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false); |
| | | if (!IsTianziBoss()) |
| | | { |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false); |
| | | } |
| | | break; |
| | | case PlayerDataType.XP: |
| | | long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx); |
| | |
| | | return true; |
| | | } |
| | | |
| | | public virtual void Hurt(BattleHurtParam battleHurtParam) |
| | | public virtual DeathRecordAction Hurt(BattleHurtParam battleHurtParam, RecordAction _causingRecordAction = null) |
| | | { |
| | | DeathRecordAction recordAction = null; |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1; |
| | | bool firstHit = battleHurtParam.hitIndex == 0; |
| | | |
| | |
| | | if (isLastHit) |
| | | { |
| | | DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this); |
| | | // 【使用 BattleField.recordPlayer】 |
| | | // 原因:闪避完成动作是目标角色的独立行为,不是技能内部产生的 |
| | | // 虽然是在Hurt过程中触发,但是闪避动作本身是目标的反应,应该由主RecordPlayer管理 |
| | | // 使用InsertRecord可以插到队列最前面,保证闪避表现的优先级 |
| | | battleField.recordPlayer.InsertRecord(dodgeFinish); |
| | | } |
| | | |
| | |
| | | { |
| | | PushDropItems(battleHurtParam.battleDrops); |
| | | } |
| | | battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack }); |
| | | recordAction = battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, _causingRecordAction); |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (dmgInfo.IsType(DamageType.Block)) |
| | | { |
| | | battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp); |
| | | battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp, teamHero.modelScale); |
| | | } |
| | | // else |
| | | // { |
| | |
| | | { |
| | | if (!buffMgr.isControled[BattleConst.HardControlGroup]) |
| | | { |
| | | battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX); |
| | | battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false); |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | } |
| | | } |
| | | // } |
| | | |
| | | } |
| | | |
| | | return recordAction; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | battleField.battleTweenMgr.OnPlayTween(tween); |
| | | } |
| | | |
| | | public virtual void OnDeath(Action _onDeathAnimationComplete) |
| | | public virtual void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false) |
| | | { |
| | | buffMgr.RemoveAllBuff(); |
| | | battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX); |
| | | motionBase.PlayDeadAnimation(() => |
| | | battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false); |
| | | if (withoutAnime) |
| | | { |
| | | teamHero.isDead = true; |
| | | OnDeadAnimationComplete(); |
| | | SetDeath(); |
| | | _onDeathAnimationComplete?.Invoke(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | motionBase.PlayDeadAnimation(() => |
| | | { |
| | | SetDeath(); |
| | | _onDeathAnimationComplete?.Invoke(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public void SetDeath() |
| | | { |
| | | teamHero.isDead = true; |
| | | OnDeadAnimationComplete(); |
| | | } |
| | | |
| | | protected virtual void OnDeadAnimationComplete() |
| | |
| | | buffMgr.RemoveAllBuff(); |
| | | } |
| | | |
| | | public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData) |
| | | // 释放者就是复活者时调用 |
| | | public void PreReborn(bool reviveSelf = false) |
| | | { |
| | | // 处理复活逻辑 |
| | | teamHero.curHp = GeneralDefine.GetFactValue(vNetData.CurHP, vNetData.CurHPEx); |
| | | // Debug.LogError("OnReborn " + teamHero.curHp); |
| | | teamHero.isDead = false; |
| | | heroGo.SetActive(true); |
| | | motionBase.ResetToIdleAnimation(); |
| | | motionBase.skeletonAnim.skeleton.A = 0f; |
| | | motionBase.skeletonAnim.LateUpdate(); |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | motionBase.ResetForReborn(reviveSelf); |
| | | } |
| | | |
| | | // 复活action |
| | | public void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData, bool reviveSelf = false, RecordAction parentAction = null) |
| | | { |
| | | isReborning = true; |
| | | heroGo.SetActive(true); |
| | | motionBase.ResetForReborn(reviveSelf); |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | motionBase.skeletonAnim.skeleton.A = 0f; |
| | | motionBase.skeletonAnim.LateUpdate(); |
| | | |
| | | } |
| | | |
| | | public void AfterReborn() |
| | | { |
| | | // 清空所有 |
| | | motionBase.ResetForReborn(false); |
| | | isReborning = false; |
| | | } |
| | | |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam) |
| | |
| | | protected virtual BattleDmgInfo PopDamageForCaster(BattleHurtParam battleHurtParam) |
| | | { |
| | | // 传入 isCasterView=true 表示这是施法者视角 |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam, isCasterView: true); |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam, _isCasterView: true); |
| | | |
| | | BattleObject boss = battleField.FindBoss(); |
| | | if (boss != null && battleField.MapID == 30020 && boss.ObjID == this.ObjID) |
| | |
| | | heroGo.SetActive(true); |
| | | motionBase.HaveRest(); |
| | | heroRectTrans.anchoredPosition = Vector2.zero; |
| | | heroInfoBar.HaveRest(); |
| | | isReborning = false; |
| | | |
| | | heroInfoBar.SetActive(false); |
| | | SetFront(); |
| | | } |
| | | |
| | |
| | | { |
| | | case PlayerDataType.HP: |
| | | long toHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx); |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, true); |
| | | bool isMinus = teamHero.curHp > toHp; |
| | | if (!IsTianziBoss()) |
| | | { |
| | | heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp, false); |
| | | } |
| | | teamHero.curHp = newValue; |
| | | // Debug.LogError("OnObjPropertyRefreshView " + teamHero.curHp); |
| | | break; |
| | | case PlayerDataType.MaxHP: |
| | | teamHero.maxHp = newValue; |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, true); |
| | | if (!IsTianziBoss()) |
| | | { |
| | | heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false); |
| | | } |
| | | break; |
| | | case PlayerDataType.XP: |
| | | long toXp = newValue; |