| | |
| | | public GameObject heroGo => _heroGo; |
| | | |
| | | public MotionBase motionBase; |
| | | |
| | | public TeamHero teamHero { get; private set; } |
| | | |
| | | // Buff 管理器(只有 Hero 有 buff 系统) |
| | | public BattleObjectBuffMgr buffMgr; |
| | | |
| | | private RectTransform m_heroRectTrans; |
| | | |
| | |
| | | public void Init(GameObject _heroGo, TeamHero _teamHero, BattleCamp _camp) |
| | | { |
| | | this._heroGo = _heroGo; |
| | | Init(_teamHero, _camp); |
| | | } |
| | | |
| | | public override void Init(TeamHero _teamHero, BattleCamp _camp) |
| | | { |
| | | teamHero = _teamHero; |
| | | Camp = _camp; |
| | | ObjID = _teamHero.ObjID; |
| | | InitInternal(); |
| | | } |
| | | |
| | | |
| | | private void InitInternal() |
| | | { |
| | | motionBase = new MotionBase(); |
| | | motionBase.Init(_heroGo.GetComponentInChildren<SkeletonAnimation>(true)); |
| | | buffMgr = new BattleObjectBuffMgr(); |
| | |
| | | heroInfoBar.SetActive(true); |
| | | } |
| | | SetFront(); |
| | | |
| | | if (battleField.ToString() != BattleConst.StoryBattleField && |
| | | battleField.ToString() != BattleConst.TianziBillboradBattleField) |
| | | { |
| | | var hitArea = heroGo.GetComponent<Image>(); |
| | | if (hitArea == null) |
| | | { |
| | | hitArea = heroGo.AddComponent<Image>(); |
| | | hitArea.color = new Color(0, 0, 0, 0); //让射线检测到 |
| | | } |
| | | |
| | | var btn = heroGo.GetComponent<ButtonEx>(); |
| | | if (btn == null) |
| | | { |
| | | btn = heroGo.AddComponent<ButtonEx>(); |
| | | btn.interval = 0.5f;// 防止频繁连续点击 |
| | | } |
| | | |
| | | btn.AddListener(() => |
| | | { |
| | | // 判断点击的是我方阵营还是敌方阵营,目前左边都是我方阵营 |
| | | bool isMySide = Camp == BattleCamp.Red; |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_CLICK_HERO, new BattleClickHeroData() |
| | | { |
| | | battleName = battleField.ToString(), |
| | | isMySide = isMySide, |
| | | mapID = battleField.MapID, |
| | | funcLineID = battleField.FuncLineID, |
| | | npcID = teamHero.NPCID, |
| | | posNum = teamHero.positionNum, |
| | | heroID = teamHero.heroId, |
| | | teams = battleField?.battleObjMgr.GetBattleObjList(isMySide ? BattleCamp.Red : BattleCamp.Blue), |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public override void Run() |
| | |
| | | } |
| | | } |
| | | |
| | | public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete) |
| | | public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillSkinConfig skillSkinConfig, SkillBase skillBase, bool isCounter, Action onComplete) |
| | | { |
| | | return motionBase.PlaySkillAnimation(skillConfig, skillBase, isCounter, onComplete); |
| | | return motionBase.PlaySkillAnimation(skillConfig, skillSkinConfig, skillBase, isCounter, onComplete); |
| | | } |
| | | |
| | | public override bool CanStartDeath() |
| | |
| | | return motionBase.CanStartDeath(); |
| | | } |
| | | |
| | | public override bool CanCastSkillAnimation(SkillConfig skillConfig) |
| | | public override bool CanCastSkillAnimation(SkillSkinConfig skillSkinConfig) |
| | | { |
| | | return motionBase.CanCastSkill(skillConfig); |
| | | return motionBase.CanCastSkill(skillSkinConfig); |
| | | } |
| | | |
| | | public override SkeletonAnimation GetSkeletonAnimation() |
| | |
| | | public override DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null) |
| | | { |
| | | DeathRecordAction recordAction = null; |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1; |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillSkinConfig.DamageDivide.Length - 1; |
| | | bool firstHit = battleHurtParam.hitIndex == 0; |
| | | |
| | | // 添加调试日志 |
| | |
| | | |
| | | // ============ 应用目标的血量和护盾变化 ============ |
| | | ApplyHurtToTarget(battleHurtParam, isLastHit); |
| | | |
| | | |
| | | // 这里 |
| | | if (dmgInfo.IsType(DamageType.Dodge) /*&& !buffMgr.isControled[BattleConst.HardControlGroup]*/)//如果被控制了还闪避了 要看看服务器怎么处理了 |
| | | if (dmgInfo.IsType(DamageType.Dodge) || dmgInfo.IsType(DamageType.CompletelyDodge))//如果被控制了还闪避了 要看看服务器怎么处理了 |
| | | { |
| | | if (isLastHit) |
| | | { |
| | |
| | | |
| | | if (firstHit) |
| | | { |
| | | OnDodgeBegin(); |
| | | OnDodgeBegin(dmgInfo.IsType(DamageType.Dodge) ? DamageType.Dodge : DamageType.CompletelyDodge); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | const float pingpongTime = 0.4f; |
| | | // 闪避开始 |
| | | public override void OnDodgeBegin() |
| | | public override void OnDodgeBegin(DamageType damageType) |
| | | { |
| | | RectTransform rectTrans = heroRectTrans; |
| | | var tween = rectTrans.DOAnchorPos(new Vector3(-30, 0, 0), pingpongTime) |
| | |
| | | |
| | | motionBase.ShowIllusionShadow(true); |
| | | |
| | | DamageNumConfig damageNumConfig = DamageNumConfig.Get((int)DamageType.Dodge); |
| | | int damageTypeInt = damageType == DamageType.Dodge ? (int)damageType : BattleConst.CompletelyDodge; |
| | | |
| | | DamageNumConfig damageNumConfig = DamageNumConfig.Get(damageTypeInt); |
| | | |
| | | string dodgeStr = ((char)damageNumConfig.prefix).ToString(); |
| | | |
| | |
| | | motionBase.ResetForReborn(false); |
| | | isReborning = false; |
| | | } |
| | | |
| | | // ============ 实现抽象访问方法 ============ |
| | | |
| | | public override BattleObjectBuffMgr GetBuffMgr() => buffMgr; |
| | | |
| | | public override int GetPositionNum() => teamHero.positionNum; |
| | | public override float GetModelScale() => teamHero.modelScale; |
| | | public override string GetName() => teamHero.name; |
| | | |
| | | protected override bool GetIsStunned() => teamHero.isStunned; |
| | | protected override bool GetIsFrozen() => teamHero.isFrozen; |
| | | protected override bool GetIsStoned() => teamHero.isStoned; |
| | | protected override bool GetIsSlient() => teamHero.isSlient; |
| | | protected override bool GetIsDisarmed() => teamHero.isDisarmed; |
| | | protected override bool GetIsInvincible() => teamHero.isInvinceble; |
| | | protected override bool GetIsDead() => teamHero.isDead; |
| | | public override int GetRage() => teamHero.rage; |
| | | |
| | | protected override void ApplyCasterHpChange(long newHp) |
| | | { |
| | | if (teamHero == null) return; |
| | | teamHero.curHp = newHp; |
| | | } |
| | | |
| | | public override long GetCurHp() => teamHero == null ? 0 : teamHero.curHp; |
| | | public override long GetMaxHp() => teamHero == null ? 0 : teamHero.maxHp; |
| | | public override void SetCurHp(long value) { if (teamHero == null) return; teamHero.curHp = value; } |
| | | public override void SetIsDead(bool value) { if (teamHero == null) return; teamHero.isDead = value; } |
| | | |
| | | public override int GetNPCID() => teamHero == null ? 0 : teamHero.NPCID; |
| | | public override long GetFightPower() => teamHero == null ? 0 : teamHero.fightPower; |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected override BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam) |
| | |
| | | } |
| | | |
| | | // ============ 应用施法者的血量和护盾变化 ============ |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1; |
| | | bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillSkinConfig.DamageDivide.Length - 1; |
| | | ApplyHurtToCaster(battleHurtParam, isLastHit); |
| | | |
| | | // 和Hurt一样,调用PopDamage处理吸血/反伤的显示 |