From d1ec6bf485cf9179d157554eaef7a2339233dd03 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 28 一月 2026 17:04:08 +0800
Subject: [PATCH] 命格 重构战斗代码
---
Main/System/Battle/SkillEffect/NormalSkillEffect.cs | 4
Main/System/Battle/SkillEffect/NoEffect.cs | 4
Main/System/Battle/BattleConst.cs | 2
Main/System/Battle/BattleObject/BattleObjectFactory.cs | 35 +
Main/System/Battle/BattleObject/MinggeBattleObject.cs | 157 +++++
Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs | 11
Main/System/Battle/BattleObject/HeroBattleObject.cs.meta | 11
Main/System/Battle/Buff/BattleObjectBuffMgr.cs | 6
Main/System/Battle/TianziBillboradBattleWin.cs | 10
Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs | 4
Main/System/Battle/BattleField/BattleField.cs | 8
Main/System/Battle/BattleObject/BattleObject.cs | 685 +++++-----------------
Main/System/Battle/BattleObject/MinggeBattleObject.cs.meta | 11
Main/System/Battle/SkillEffect/DotSkillEffect.cs | 2
Main/Component/UI/Effect/BattleEffectPlayer.cs | 5
Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs | 7
Main/System/Battle/BattleHUDWin.cs | 4
Main/System/Battle/SkillEffect/SkillEffect.cs | 6
Main/System/Battle/BattleObject/HeroBattleObject.cs | 680 ++++++++++++++++++++++
Main/System/Battle/SkillEffect/BulletSkillEffect.cs | 38
Main/System/Battle/BattleField/RecordActions/BuffMountAction.cs | 2
Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs | 8
Main/System/Battle/Skill/SkillBase.cs | 52 -
Main/System/Battle/BattleObject/BattleObjMgr.cs | 2
Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs | 6
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs | 2
26 files changed, 1,154 insertions(+), 608 deletions(-)
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 4313a8f..2c7e222 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -684,12 +684,11 @@
public void BindBone(BattleObject battleObject, string v)
{
- if (battleObject == null || battleObject.motionBase == null || battleObject.motionBase.skeletonAnim == null)
+ var skeletonAnim = battleObject?.GetSkeletonAnimation();
+ if (skeletonAnim == null)
{
return;
}
-
- var skeletonAnim = battleObject.motionBase.skeletonAnim;
Bone bone = skeletonAnim.skeleton.FindBone(v);
isBindBone = false;
diff --git a/Main/System/Battle/BattleConst.cs b/Main/System/Battle/BattleConst.cs
index c37db6f..76af730 100644
--- a/Main/System/Battle/BattleConst.cs
+++ b/Main/System/Battle/BattleConst.cs
@@ -84,6 +84,8 @@
public const int BreakArmor = 100007; // 璐┛
public const int Parry = 100008; // 鎷涙灦
+
+ public const int CompletelyDodge = 100009;// 缁濆闂伩
#endregion
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 35b3bb1..89453cc 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -651,9 +651,9 @@
foreach (var obj in blueTeam)
{
- obj.heroGo.SetActive(true);
- obj.motionBase.PlayAnimation(MotionName.run, true);
- RectTransform trans = obj.heroRectTrans;
+ obj.SetActive(true);
+ obj.PlayAnimation(MotionName.run, true);
+ RectTransform trans = obj.GetRectTransform();
trans.anchoredPosition = new Vector2(-800, 0);
tween = trans.DOAnchorPos(Vector2.zero, 1f).SetEase(Ease.Linear);
battleTweenMgr.OnPlayTween(tween);
@@ -663,7 +663,7 @@
{
foreach (var obj in blueTeam)
{
- obj.motionBase.PlayAnimation(MotionName.idle, true);
+ obj.PlayAnimation(MotionName.idle, true);
}
// 鎾斁鎴樻枟寮�濮嬬殑鐗规晥
diff --git a/Main/System/Battle/BattleField/RecordActions/BuffMountAction.cs b/Main/System/Battle/BattleField/RecordActions/BuffMountAction.cs
index 858697d..b6c9667 100644
--- a/Main/System/Battle/BattleField/RecordActions/BuffMountAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/BuffMountAction.cs
@@ -46,7 +46,7 @@
tipsInfo.useBuffColor = true;
tipsInfo.isDebuff = skillConfig.IsDebuff();
- obj.heroInfoBar.ShowTips(tipsInfo);
+ obj.ShowTips(tipsInfo);
}
}
diff --git a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
index b0a3551..a184d25 100644
--- a/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/DeathRecordAction.cs
@@ -185,7 +185,7 @@
bool isComplete = false;
// 濡傛灉娌℃湁閲婃斁鎶�鑳� 鍒欑洿鎺ユ浜�
- if (deadObj.motionBase.CanStartDeath())
+ if (deadObj.CanStartDeath())
{
PerformDrop(deadObj);
@@ -201,7 +201,7 @@
return () =>
{
// 杩樻病鎾斁姝讳骸 骞朵笖娌¢噴鏀惧叾浠栨妧鑳�
- if (!playDeath && deadObj.motionBase.CanStartDeath())
+ if (!playDeath && deadObj.CanStartDeath())
{
PerformDrop(deadObj);
@@ -212,7 +212,7 @@
playDeath = true;
}
- if (deadObj.isReborning)
+ if (deadObj.IsReborning())
{
isComplete = true;
}
diff --git a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
index fcfe947..9a3bb9b 100644
--- a/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/RebornRecordAction.cs
@@ -78,14 +78,14 @@
Sequence sequence = DOTween.Sequence();
// 鎾斁澶嶆椿鐗规晥
- battleField.battleEffectMgr.PlayEffect(battleObj, BattleConst.RebornEffectID, battleObj.heroRectTrans, battleObj.Camp, battleObj.teamHero.modelScale);
+ battleField.battleEffectMgr.PlayEffect(battleObj, BattleConst.RebornEffectID, battleObj.GetRectTransform(), battleObj.Camp, battleObj.teamHero.modelScale);
// 娓愬彉
- battleObj.motionBase.skeletonAnim.skeleton.A = 0f;
+ battleObj.SetSkeletonAlpha(0f);
sequence.Append(DOVirtual.Float(0f, 1f, tweenDuration / battleField.speedRatio, value =>
{
- battleObj.motionBase.skeletonAnim.skeleton.A = value;
+ battleObj.SetSkeletonAlpha(value);
}));
tweenSeq.Join(sequence);
@@ -120,7 +120,7 @@
foreach (var bo in rebornObjs)
{
var battleObj = bo;
- battleObj.motionBase.skeletonAnim.skeleton.A = 1f;
+ battleObj.SetSkeletonAlpha(1f);
battleObj.AfterReborn();
}
diff --git a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
index 8385d78..c2a705d 100644
--- a/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
+++ b/Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -175,7 +175,7 @@
if (isCast)
return;
- if (skillBase.caster.motionBase.CanCastSkill(skillBase.skillConfig))
+ if (skillBase.caster.CanCastSkillAnimation(skillBase.skillConfig))
{
// Debug.LogError("cast skill id is " + skillBase.skillConfig.SkillID);
diff --git a/Main/System/Battle/BattleHUDWin.cs b/Main/System/Battle/BattleHUDWin.cs
index bdbbc49..9c3f555 100644
--- a/Main/System/Battle/BattleHUDWin.cs
+++ b/Main/System/Battle/BattleHUDWin.cs
@@ -157,7 +157,7 @@
{
if (damageInfo.targetDamageList.Count == 0) return;
- RectTransform heroRect = damageInfo.hurtObj.heroRectTrans;
+ RectTransform heroRect = damageInfo.hurtObj.GetRectTransform();
if (heroRect == null) return;
DamageContent content = CreateDamageContent();
@@ -186,7 +186,7 @@
{
if (damageInfo.casterDamageList.Count == 0) return;
- RectTransform heroRect = damageInfo.casterObj.heroRectTrans;
+ RectTransform heroRect = damageInfo.casterObj.GetRectTransform();
if (heroRect == null) return;
// 鍒涘缓鍗曚釜DamageContent鏄剧ず鎵�鏈夋柦娉曡�呬激瀹�
diff --git a/Main/System/Battle/BattleObject/BattleObjMgr.cs b/Main/System/Battle/BattleObject/BattleObjMgr.cs
index 446cc62..145cdac 100644
--- a/Main/System/Battle/BattleObject/BattleObjMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjMgr.cs
@@ -46,7 +46,7 @@
if (teamHero != null)
{
BattleObject battleObj = BattleObjectFactory.CreateBattleObject(battleField, posNodeList, teamHero, _Camp);
- battleObj.heroGo.SetActive(active);
+ battleObj.SetActive(active);
allBattleObjDict.Add(battleObj.ObjID, battleObj);
campDict.Add(teamHero.positionNum, battleObj);
battleObj.SetSpeedRatio(battleField.speedRatio);
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index ef76ebb..76287ac 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -26,7 +26,7 @@
Burned = 1 << 5
}
-public class BattleObject
+public abstract class BattleObject
{
public BattleField battleField;
@@ -40,197 +40,162 @@
public TeamHero teamHero { get; protected set; }
- public MotionBase motionBase;
-
- public GameObject heroGo
- {
- get;
- private set;
- }
-
- protected BattleDrops m_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;
-
- private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>();
- public BattleHeroInfoBar heroInfoBar;
-
- public bool isReborning = false;
-
public BattleObject(BattleField _battleField)
{
battleField = _battleField;
}
- public virtual void Init(GameObject _heroGo, TeamHero _teamHero, BattleCamp _camp)
+ public abstract void Init(TeamHero _teamHero, BattleCamp _camp);
+
+ public abstract void Run();
+
+ public abstract void Pause();
+
+ public abstract void Resume();
+
+ public abstract void Destroy();
+
+ // ============ 鍔ㄧ敾鐩稿叧鎶借薄鏂规硶锛堟浛浠� motionBase 鐩存帴璋冪敤锛� ============
+
+ /// <summary>
+ /// 鎾斁鍔ㄧ敾
+ /// </summary>
+ public abstract void PlayAnimation(MotionName motionName, bool loop);
+
+ /// <summary>
+ /// 鏄剧ず骞诲奖娈嬪奖
+ /// </summary>
+ public abstract void ShowIllusionShadow(bool show, Color? color = null);
+
+ /// <summary>
+ /// 鎾斁鎶�鑳藉姩鐢�
+ /// </summary>
+ public abstract Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete);
+
+ /// <summary>
+ /// 妫�鏌ユ槸鍚﹀彲浠ュ紑濮嬫浜�
+ /// </summary>
+ public abstract bool CanStartDeath();
+
+ /// <summary>
+ /// 妫�鏌ユ槸鍚﹀彲浠ラ噴鏀炬妧鑳�
+ /// </summary>
+ public abstract bool CanCastSkillAnimation(SkillConfig skillConfig);
+
+ /// <summary>
+ /// 鑾峰彇楠ㄩ鍔ㄧ敾缁勪欢锛堢敤浜庣壒鏁堟寕杞界瓑锛�
+ /// </summary>
+ public abstract SkeletonAnimation GetSkeletonAnimation();
+
+ /// <summary>
+ /// 璁剧疆楠ㄩ鍔ㄧ敾閫忔槑搴�
+ /// </summary>
+ public abstract void SetSkeletonAlpha(float alpha);
+
+ /// <summary>
+ /// 鑾峰彇 RectTransform锛堢敤浜庣Щ鍔ㄧ瓑鎿嶄綔锛�
+ /// </summary>
+ public virtual RectTransform GetRectTransform() => null;
+
+ /// <summary>
+ /// 鑾峰彇 GameObject
+ /// </summary>
+ public virtual GameObject GetGameObject() => null;
+
+ /// <summary>
+ /// 鑾峰彇 Transform锛堢敤浜庣壒鏁堟寕杞界瓑锛�
+ /// </summary>
+ public virtual Transform GetTransform() => null;
+
+ /// <summary>
+ /// 鑾峰彇涓栫晫鍧愭爣浣嶇疆
+ /// </summary>
+ public virtual Vector3 GetPosition() => Vector3.zero;
+
+ /// <summary>
+ /// 鑾峰彇琛�鏉′俊鎭爮
+ /// </summary>
+ public virtual BattleHeroInfoBar GetHeroInfoBar() => null;
+
+ /// <summary>
+ /// 鍒锋柊Buff鏄剧ず
+ /// </summary>
+ public virtual void RefreshBuff(List<HB428_tagSCBuffRefresh> buffList) { }
+
+ /// <summary>
+ /// 鏇存柊琛�閲忔樉绀�
+ /// </summary>
+ public virtual void UpdateHP(float percentage) { }
+
+ /// <summary>
+ /// 鏄惁姝e湪澶嶆椿涓�
+ /// </summary>
+ public virtual bool IsReborning() => false;
+
+ /// <summary>
+ /// 璁剧疆澶嶆椿鐘舵��
+ /// </summary>
+ public virtual void SetReborning(bool value) { }
+
+ /// <summary>
+ /// 璁剧疆 GameObject 婵�娲荤姸鎬�
+ /// </summary>
+ public virtual void SetActive(bool active) { }
+
+ /// <summary>
+ /// 閲嶇疆浣嶇疆鍒板師鐐�
+ /// </summary>
+ public virtual void ResetPosition() { }
+
+ /// <summary>
+ /// 璁剧疆鏈濆悜锛堥�氳繃缂╂斁锛�
+ /// </summary>
+ public virtual void SetFacing(float direction) { }
+
+ /// <summary>
+ /// 閲嶇疆鏈濆悜锛堟湞鍚戝彸杈癸級
+ /// </summary>
+ public virtual void ResetFacing() { }
+
+ /// <summary>
+ /// 鍋滄鎵�鏈夌Щ鍔ㄥ姩鐢�
+ /// </summary>
+ public virtual void StopMoveAnimation() { }
+
+ /// <summary>
+ /// 鏄剧ず鎻愮ず淇℃伅锛堢畝鍗曠増鏈級
+ /// </summary>
+ public virtual void ShowTips(string message, bool useArtText = false, bool followCharacter = true, float scaleRatio = 1f) { }
+
+ /// <summary>
+ /// 鏄剧ず鎻愮ず淇℃伅锛堝畬鏁寸増鏈級
+ /// </summary>
+ public virtual void ShowTips(BattleHeroInfoBar.TipsInfo tipsInfo) { }
+
+ /// <summary>
+ /// 璁剧疆姝讳骸鐘舵�侊紙Hero 鐗瑰畾锛�
+ /// </summary>
+ public virtual void SetDeath() { }
+
+ /// <summary>
+ /// 澶嶆椿鍚庡鐞嗭紙Hero 鐗瑰畾锛�
+ /// </summary>
+ public virtual void AfterReborn() { }
+
+ /// <summary>
+ /// 澶嶆椿鍓嶅噯澶囷紙Hero 鐗瑰畾锛�
+ /// </summary>
+ public virtual void PreReborn(bool reviveSelf = false) { }
+
+ /// <summary>
+ /// 澶嶆椿鍔ㄤ綔锛圚ero 鐗瑰畾锛�
+ /// </summary>
+ public virtual void OnReborn(HB427_tagSCUseSkill.tagSCUseSkillHurt vNetData, bool reviveSelf = false, RecordAction parentAction = null) { }
+
+ public virtual void OnObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo)
{
- heroGo = _heroGo;
- teamHero = _teamHero;
- Camp = _camp;
- motionBase = new MotionBase();
- motionBase.Init(heroGo.GetComponentInChildren<SkeletonAnimation>(true));
- buffMgr = new BattleObjectBuffMgr();
- buffMgr.Init(this);
-
- buffMgr.onIsControlChanged += OnControledChange;
-
- layerMgr = new BattleObjectLayerMgr();
- layerMgr.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;
- if (battleField is StoryBattleField && (battleField as StoryBattleField).battleState == StoryBattleState.Break)
- {
- //涓荤嚎鍏冲崱浼戞伅涓殑涓嶆樉绀鸿鏉�
- heroInfoBar.SetActive(false);
- }
- else
- {
- heroInfoBar.SetActive(true);
- }
- SetFront();
+ // 瀛愮被瀹炵幇
}
-
-
- public virtual void Run()
- {
- motionBase.Run();
- heroInfoBar.Run();
- buffMgr.Run();
- }
-
- public virtual void Pause()
- {
- motionBase.Pause();
- }
-
- public virtual void Resume()
- {
- motionBase.Resume();
- }
-
- public virtual void Destroy()
- {
-
- motionBase.Release();
- motionBase = null;
- buffMgr.onIsControlChanged -= OnControledChange;
- buffMgr.Release();
- buffMgr = null;
- teamHero = null;
- ObjID = 0;
-
- if (heroGo != null)
- {
- GameObject.DestroyImmediate(heroGo);
- heroGo = null;
- }
- }
-
- // 鏈夊彉鍖栦簡鎵嶄細璋冪敤杩欎釜鍑芥暟
- 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);
- 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);
- if (!IsTianziBoss())
- {
- heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
- }
- break;
- case PlayerDataType.XP:
- long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
- heroInfoBar.UpdateXP(teamHero.rage, toXp, 100);
- teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
- break;
- default:
- Debug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
- break;
- }
- }
-
- // 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, 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, false);
- // break;
- // case PlayerDataType.XP:
- // long toXp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
- // heroInfoBar.UpdateXP(teamHero.rage, toXp, 100);
- // teamHero.rage = (int)GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
- // break;
- // default:
- // Debug.LogError("BattleObject.ObjPropertyRefreshView 鍑虹幇鎰忓绫诲瀷 " + vNetData.RefreshType.ToString());
- // break;
- // }
- // }
// 鐪╂檿
public bool IsStunned()
@@ -315,250 +280,17 @@
return true;
}
- public virtual DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null)
- {
- DeathRecordAction recordAction = null;
- bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
- bool firstHit = battleHurtParam.hitIndex == 0;
-
- // 娣诲姞璋冭瘯鏃ュ織
- bool isHealing = BattleUtility.IsHealing(battleHurtParam.hurt);
-
- BattleDmgInfo dmgInfo = PopDamage(battleHurtParam);
+ public abstract DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null);
+ public abstract void OnDodgeBegin();
- // ============ 搴旂敤鐩爣鐨勮閲忓拰鎶ょ浘鍙樺寲 ============
- ApplyHurtToTarget(battleHurtParam, isLastHit);
+ public abstract void OnDodgeEnd(Action _complete = null);
- // 杩欓噷
- if (dmgInfo.IsType(DamageType.Dodge) /*&& !buffMgr.isControled[BattleConst.HardControlGroup]*/)//濡傛灉琚帶鍒朵簡杩橀棯閬夸簡 瑕佺湅鐪嬫湇鍔″櫒鎬庝箞澶勭悊浜�
- {
- if (isLastHit)
- {
- DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
- // 銆愪娇鐢� BattleField.recordPlayer銆�
- // 鍘熷洜锛氶棯閬垮畬鎴愬姩浣滄槸鐩爣瑙掕壊鐨勭嫭绔嬭涓猴紝涓嶆槸鎶�鑳藉唴閮ㄤ骇鐢熺殑
- // 铏界劧鏄湪Hurt杩囩▼涓Е鍙戯紝浣嗘槸闂伩鍔ㄤ綔鏈韩鏄洰鏍囩殑鍙嶅簲锛屽簲璇ョ敱涓籖ecordPlayer绠$悊
- // 浣跨敤InsertRecord鍙互鎻掑埌闃熷垪鏈�鍓嶉潰锛屼繚璇侀棯閬胯〃鐜扮殑浼樺厛绾�
- battleField.recordPlayer.InsertRecord(dodgeFinish);
- }
+ public abstract void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false);
- if (firstHit)
- {
- OnDodgeBegin();
- }
- }
+ protected abstract BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam);
- bool isFatalAttack = (null != battleHurtParam.deadPack) && isLastHit;
-
- if (isFatalAttack)
- {
- if (null != battleHurtParam.battleDrops)
- {
- PushDropItems(battleHurtParam.battleDrops);
- }
- recordAction = battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, _parentSkillAction, _parentSkillAction);
-
- }
- else
- {
- if (dmgInfo.IsType(DamageType.Block))
- {
- battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp, teamHero.modelScale);
- }
- // else
- // {
- if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()))
- {
- if (!buffMgr.isControled[BattleConst.HardControlGroup])
- {
- battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false);
- motionBase.PlayAnimation(MotionName.hit, false);
- }
- }
- // }
-
- }
-
- return recordAction;
- }
-
- /// <summary>
- /// 搴旂敤鐩爣鐨勮閲忓拰鎶ょ浘鍙樺寲
- /// </summary>
- private void ApplyHurtToTarget(BattleHurtParam battleHurtParam, bool isLastHit)
- {
- BattleHurtObj hurter = battleHurtParam.hurter;
-
- // 搴旂敤琛�閲忓彉鍖�
- teamHero.curHp = hurter.toHp;
-
- // foreach (var obj in battleField.battleObjMgr.allBattleObjDict.Values)
- // {
- // Debug.LogError($"[ApplyHurtToTarget] ObjID: {obj.ObjID}, Name: {obj.teamHero.heroConfig.Name}, CurHp: {obj.teamHero.curHp}, MaxHp: {obj.teamHero.maxHp} Skill {battleHurtParam.hB427_TagSCUseSkill.packUID} ");
- // }
-
-
-#if UNITY_EDITOR
- // 鏈�鍚庝竴鍑绘椂楠岃瘉琛�閲忔槸鍚︿笌鏈嶅姟鍣ㄤ竴鑷�
- if (isLastHit)
- {
- BattleUtility.ValidateHpConsistency(battleHurtParam, "鐩爣鍙椾激");
- }
-#endif
- }
-
- const float pingpongTime = 0.4f;
- // 闂伩寮�濮�
- public virtual void OnDodgeBegin()
- {
- 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.soundManager.PlayEffectSound(BattleConst.DodgeSoundID);
-
- battleField.battleTweenMgr.OnPlayTween(tween);
- }
-
- // 闂伩缁撴潫
- public virtual void OnDodgeEnd(Action _complete = null)
- {
- RectTransform rectTrans = heroRectTrans;
-
- var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime)
- .SetEase(Ease.OutCubic);
-
- tween.onComplete += () =>
- {
- _complete?.Invoke();
- };
-
- battleField.battleTweenMgr.OnPlayTween(tween);
- }
-
- public virtual void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
- {
- buffMgr.RemoveAllBuff();
- battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false);
- if (withoutAnime)
- {
- SetDeath();
- _onDeathAnimationComplete?.Invoke();
- }
- else
- {
- motionBase.PlayDeadAnimation(() =>
- {
- SetDeath();
- _onDeathAnimationComplete?.Invoke();
- });
- }
- }
-
- public void SetDeath()
- {
- teamHero.isDead = true;
- OnDeadAnimationComplete();
- }
-
- protected virtual void OnDeadAnimationComplete()
- {
- // 鎴栬鐪嬬湅婧惰В鐗规晥锛� YYL TODO
- heroGo.SetActive(false);
-
- // 闃叉缁欐浜″璞″張涓奲uff
- buffMgr.RemoveAllBuff();
- }
-
- // 閲婃斁鑰呭氨鏄娲昏�呮椂璋冪敤
- public void PreReborn(bool reviveSelf = false)
- {
- heroGo.SetActive(true);
- 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 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
- protected virtual BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
- {
- BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam);
- // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉¢�昏緫
- BattleObject boss = battleField.FindBoss();
- // 淇锛歜attleHurtParam.hurtObj.ObjID -> battleHurtParam.hurter.hurtObj.ObjID
- if (boss != null && battleField.MapID == 30020 && boss.ObjID == battleHurtParam.hurter.hurtObj.ObjID)
- {
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
- return battleDmgInfo;
- }
- else
- {
- heroInfoBar.UpdateDamage(battleDmgInfo);
-
- // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
- return battleDmgInfo;
- }
-
- }
-
- /// <summary>
- /// 涓烘柦娉曡�呭垱寤轰激瀹充俊鎭紙鍚歌/鍙嶄激锛�
- /// </summary>
- protected virtual BattleDmgInfo PopDamageForCaster(BattleHurtParam 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)
- {
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
- return battleDmgInfo;
- }
- else
- {
- heroInfoBar.UpdateDamage(battleDmgInfo);
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
- return battleDmgInfo;
- }
- }
+ protected abstract BattleDmgInfo PopDamageForCaster(BattleHurtParam battleHurtParam);
public RectTransform GetAliasTeamNode()
{
@@ -575,26 +307,16 @@
return Camp == BattleCamp.Red ? BattleCamp.Blue : BattleCamp.Red;
}
- public void HaveRest()
- {
- // YYL TODO
- // 浼戞伅鐘舵��
- // 澶氫竴涓獄zz鐨勪竴涓壒鏁�
- heroGo.SetActive(true);
- motionBase.HaveRest();
- heroRectTrans.anchoredPosition = Vector2.zero;
- heroInfoBar.HaveRest();
- isReborning = false;
+ public abstract void HaveRest();
- SetFront();
- }
+ protected BattleDrops m_battleDrops;
- public void PushDropItems(BattleDrops _battleDrops)
+ public virtual void PushDropItems(BattleDrops _battleDrops)
{
m_battleDrops = _battleDrops;
}
- public void PerformDrop()
+ public virtual void PerformDrop()
{
if (null == m_battleDrops)
return;
@@ -603,7 +325,7 @@
EventName.BATTLE_DROP_ITEMS, battleField.guid, m_battleDrops, OnPerformDropFinish);
}
- protected void OnPerformDropFinish()
+ protected virtual void OnPerformDropFinish()
{
m_battleDrops = null;
}
@@ -618,85 +340,13 @@
layerMgr.SetFront();
}
- public void SetSpeedRatio(float ratio)
- {
- motionBase.SetSpeedRatio(ratio);
- heroInfoBar.SetSpeedRatio(ratio);
- }
+ public abstract void SetSpeedRatio(float ratio);
- public void OnObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData)
- {
- // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉�,涓嶆嫤鎴�掓皵
- BattleObject boss = battleField.FindBoss();
- if (boss != null && battleField.MapID == 30020 && boss.ObjID == vNetData.ObjID && vNetData.RefreshType != (ushort)PlayerDataType.XP)
- return;
-
- // public uint ObjID;
- // public ushort RefreshType; // 鍚�0418鍒锋柊绫诲瀷锛屽琛�閲忋�佹�掓皵
- // public uint AttackTypes; // 椋樺瓧绫诲瀷姹囨�伙紝鏀寔澶氱绫诲瀷骞跺瓨锛屽鏃犺闃插尽涓旀毚鍑诲悓鏃惰鏍兼尅锛屼簩杩涘埗鎴栬繍绠楁渶缁堝�硷紱0-澶辫触锛�1-鏅�氾紱2-鍥炶锛�5-鏍兼尅锛�6-鏃犺闃插尽锛�7-鏆村嚮锛�9-闂伩
- // public uint Value; // 鏇存柊鍊�
- // public uint ValueEx; // 鏇存柊鍊硷紝濡傛灉鏄ぇ鏁板�肩殑姝ゅ�间负鏁撮櫎浜块儴鍒�
- // public byte DiffType; // 鍙樺寲绫诲瀷锛�0-鍑忓皯锛�1-澧炲姞
- // public uint DiffValue; // 鍙樺寲鍊�
- // public uint DiffValueEx; // 鍙樺寲鍊硷紝濡傛灉鏄ぇ鏁板�肩殑姝ゅ�间负鏁撮櫎浜块儴鍒�
- // public uint SkillID; // 浣跨敤鐨勬妧鑳借〃ID
- // public uint RelatedSkillID; // 鍏宠仈鐨勬妧鑳絀D锛屼竴鑸槸涓绘妧鑳絀D锛岄潪涓绘妧鑳介澶栬Е鍙戠殑涓�0
-
- long diffValue = GeneralDefine.GetFactValue(vNetData.DiffValue, vNetData.DiffValueEx);
- diffValue *= vNetData.DiffType == 0 ? -1 : 1;
-
- long newValue = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
-
-
- switch ((PlayerDataType)vNetData.RefreshType)
- {
- case PlayerDataType.HP:
- long toHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
- 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;
- if (!IsTianziBoss())
- {
- heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
- }
- break;
- case PlayerDataType.XP:
- long toXp = newValue;
- heroInfoBar.UpdateXP(teamHero.rage, toXp, 100);
- teamHero.rage = (int)newValue;
-
- DamageNumConfig damageNumConfig = DamageNumConfig.Get((int)DamageType.RageUp);
- string message = BattleUtility.ConvertToArtFont(damageNumConfig, diffValue);
- heroInfoBar.ShowTips(new BattleHeroInfoBar.TipsInfo()
- {
- message = message,
- useArtText = true,
- followCharacter = true,
- scaleRatio = 1f,
- isRage = true
- });
- break;
- default:
- Debug.LogError("BattleObject.ObjPropertyRefreshView 鍑虹幇鎰忓绫诲瀷 " + vNetData.RefreshType.ToString());
- break;
- }
- }
+ public abstract void OnObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData);
#if UNITY_EDITOR_STOP_USING
- public void EditorRevive()
- {
- teamHero.curHp = 100;
- heroGo.SetActive(true);
- motionBase.PlayAnimation(MotionName.idle, true);
- }
+ public abstract void EditorRevive();
public List<int> TryAttack(BattleObject obj, SkillConfig skillConfig)
{
@@ -744,7 +394,7 @@
long totalReflect = casterDmgInfo.casterDamageList.Sum(d => d.damage);
if (totalReflect > 0 && !buffMgr.isControled[BattleConst.HardControlGroup])
{
- motionBase.PlayAnimation(MotionName.hit, false);
+ OnPlayHitAnimation();
}
}
}
@@ -780,4 +430,9 @@
{
return battleField.MapID == 30020 && battleField.FindBoss() == this;
}
+
+ /// <summary>
+ /// 鎾斁鍙楀嚮鍔ㄧ敾锛堝彧鏈� Hero 鏈夊疄鐜帮紝Mingge 鐣欑┖锛�
+ /// </summary>
+ protected abstract void OnPlayHitAnimation();
}
\ No newline at end of file
diff --git a/Main/System/Battle/BattleObject/BattleObjectFactory.cs b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
index d991f1d..2728efc 100644
--- a/Main/System/Battle/BattleObject/BattleObjectFactory.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectFactory.cs
@@ -47,7 +47,7 @@
GameObject battleGO = ResManager.Instance.LoadAsset<GameObject>("Hero/SpineRes", "Hero_001"/*skinCfg.SpineRes*/);
GameObject goParent = posNodeList[teamHero.positionNum];
- BattleObject battleObject = new BattleObject(_battleField);
+ BattleObject battleObject = Produce(teamHero.positionNum, _battleField);
battleObject.ObjID = teamHero.ObjID;
GameObject realGO = GameObject.Instantiate(battleGO, goParent.transform);
@@ -73,7 +73,16 @@
realGO.transform.localScale = new Vector3(finalScaleRate, finalScaleRate, finalScaleRate);
RectTransform rectTrans = realGO.GetComponent<RectTransform>();
rectTrans.anchoredPosition = Vector2.zero;
- battleObject.Init(realGO, teamHero, _Camp);
+
+ // HeroBattleObject 鎵嶆湁 GameObject 鍙傛暟鐨� Init 鏂规硶
+ if (battleObject is HeroBattleObject heroBattleObject)
+ {
+ heroBattleObject.Init(realGO, teamHero, _Camp);
+ }
+ else
+ {
+ battleObject.Init(teamHero, _Camp);
+ }
#if UNITY_EDITOR
BattleDebug.LogError(
@@ -87,6 +96,28 @@
return battleObject;
}
+ public static BattleObject Produce(int positionNum, BattleField battleField)
+ {
+ if (positionNum >= 0)
+ {
+ return new HeroBattleObject(battleField);
+ }
+ else if (positionNum == 99)
+ {
+ // 鍛芥牸
+ return new MinggeBattleObject(battleField);
+ }
+ // else if (positionNum >= 101)
+ // {
+ // // 鐏靛吔
+ // return new SpiritBeastBattleObject(battleField);
+ // }
+ else
+ {
+ return new HeroBattleObject(battleField);
+ }
+ }
+
public static void DestroyBattleObject(int key, BattleObject battleObj)
{
battleObj.Destroy();
diff --git a/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs b/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
index 8922617..5a8bd2d 100644
--- a/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjectLayerMgr.cs
@@ -22,8 +22,8 @@
public void Init(BattleObject battleObj)
{
this.battleObj = battleObj;
- frontCharRendererAdjuster = battleObj.heroGo.AddMissingComponent<RendererAdjuster>();
- behindCharRendererAdjuster = battleObj.heroRectTrans.Find("Hero/Follower/BattleHeroInfoBar/BehindHero").gameObject.AddMissingComponent<RendererAdjuster>();
+ frontCharRendererAdjuster = battleObj.GetGameObject()?.AddMissingComponent<RendererAdjuster>();
+ behindCharRendererAdjuster = battleObj.GetRectTransform()?.Find("Hero/Follower/BattleHeroInfoBar/BehindHero")?.gameObject?.AddMissingComponent<RendererAdjuster>();
frontCharRendererAdjuster.canvasOffset = BattleConst.BattleFrontCharUIOffset;
diff --git a/Main/System/Battle/BattleObject/HeroBattleObject.cs b/Main/System/Battle/BattleObject/HeroBattleObject.cs
new file mode 100644
index 0000000..9218667
--- /dev/null
+++ b/Main/System/Battle/BattleObject/HeroBattleObject.cs
@@ -0,0 +1,680 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using DG.Tweening;
+using DG.Tweening.Core;
+using DG.Tweening.Plugins.Options;
+using Spine.Unity;
+using UnityEngine.UI;
+using System.Linq;
+
+public class HeroBattleObject : BattleObject
+{
+ private GameObject _heroGo;
+ public GameObject heroGo => _heroGo;
+
+ public MotionBase motionBase;
+
+ private RectTransform m_heroRectTrans;
+
+ public RectTransform heroRectTrans
+ {
+ get
+ {
+ if (m_heroRectTrans == null && _heroGo != null)
+ {
+ m_heroRectTrans = _heroGo.GetComponent<RectTransform>();
+ }
+ return m_heroRectTrans;
+ }
+ }
+
+ protected Action onDeathAnimationComplete;
+
+ protected Renderer[] renderers;
+
+ private List<HB405_tagMCAddExp> hB405_tagMCAddExps = new List<HB405_tagMCAddExp>();
+
+ private BattleHeroInfoBar _heroInfoBar;
+ public BattleHeroInfoBar heroInfoBar => _heroInfoBar;
+
+ private bool _isReborning = false;
+ public bool isReborning
+ {
+ get => _isReborning;
+ set => _isReborning = value;
+ }
+
+ public HeroBattleObject(BattleField _battleField) : base(_battleField)
+ {
+ }
+
+ 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;
+ motionBase = new MotionBase();
+ motionBase.Init(_heroGo.GetComponentInChildren<SkeletonAnimation>(true));
+ buffMgr = new BattleObjectBuffMgr();
+ buffMgr.Init(this);
+
+ buffMgr.onIsControlChanged += OnControledChange;
+
+ layerMgr = new BattleObjectLayerMgr();
+ layerMgr.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;
+ if (battleField is StoryBattleField && (battleField as StoryBattleField).battleState == StoryBattleState.Break)
+ {
+ //涓荤嚎鍏冲崱浼戞伅涓殑涓嶆樉绀鸿鏉�
+ heroInfoBar.SetActive(false);
+ }
+ else
+ {
+ heroInfoBar.SetActive(true);
+ }
+ SetFront();
+ }
+
+ public override void Run()
+ {
+ motionBase.Run();
+ heroInfoBar.Run();
+ buffMgr.Run();
+ }
+
+ public override void Pause()
+ {
+ motionBase.Pause();
+ }
+
+ public override void Resume()
+ {
+ motionBase.Resume();
+ }
+
+ public override void Destroy()
+ {
+ motionBase.Release();
+ motionBase = null;
+ buffMgr.onIsControlChanged -= OnControledChange;
+ buffMgr.Release();
+ buffMgr = null;
+ teamHero = null;
+ ObjID = 0;
+
+ if (_heroGo != null)
+ {
+ GameObject.DestroyImmediate(_heroGo);
+ _heroGo = null;
+ }
+ }
+
+ // ============ 鍔ㄧ敾鐩稿叧鏂规硶瀹炵幇锛堥�氳繃 motionBase锛� ============
+
+ public override void PlayAnimation(MotionName motionName, bool loop)
+ {
+ motionBase.PlayAnimation(motionName, loop);
+ }
+
+ public override void ShowIllusionShadow(bool show, Color? color = null)
+ {
+ if (color.HasValue)
+ {
+ motionBase.ShowIllusionShadow(show, color.Value);
+ }
+ else
+ {
+ motionBase.ShowIllusionShadow(show);
+ }
+ }
+
+ public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete)
+ {
+ return motionBase.PlaySkillAnimation(skillConfig, skillBase, isCounter, onComplete);
+ }
+
+ public override bool CanStartDeath()
+ {
+ return motionBase.CanStartDeath();
+ }
+
+ public override bool CanCastSkillAnimation(SkillConfig skillConfig)
+ {
+ return motionBase.CanCastSkill(skillConfig);
+ }
+
+ public override SkeletonAnimation GetSkeletonAnimation()
+ {
+ return motionBase.skeletonAnim;
+ }
+
+ public override void SetSkeletonAlpha(float alpha)
+ {
+ if (motionBase.skeletonAnim != null)
+ {
+ motionBase.skeletonAnim.skeleton.A = alpha;
+ }
+ }
+
+ public override RectTransform GetRectTransform() => heroRectTrans;
+
+ public override GameObject GetGameObject() => _heroGo;
+
+ public override Transform GetTransform() => _heroGo?.transform;
+
+ public override Vector3 GetPosition() => heroRectTrans != null ? heroRectTrans.position : Vector3.zero;
+
+ public override BattleHeroInfoBar GetHeroInfoBar() => _heroInfoBar;
+
+ public override void RefreshBuff(List<HB428_tagSCBuffRefresh> buffList)
+ {
+ _heroInfoBar?.RefreshBuff(buffList);
+ }
+
+ public override void UpdateHP(float percentage)
+ {
+ _heroInfoBar?.UpdateHP(percentage);
+ }
+ public override bool IsReborning() => _isReborning;
+
+ public override void SetReborning(bool value) => _isReborning = value;
+
+ public override void SetActive(bool active)
+ {
+ if (_heroGo != null)
+ {
+ _heroGo.SetActive(active);
+ }
+ }
+
+ public override void ResetPosition()
+ {
+ if (heroRectTrans != null)
+ {
+ heroRectTrans.anchoredPosition = Vector2.zero;
+ }
+ }
+
+ public override void SetFacing(float direction)
+ {
+ if (_heroGo != null)
+ {
+ Vector3 scale = _heroGo.transform.localScale;
+ scale.x = Mathf.Abs(scale.x) * direction;
+ _heroGo.transform.localScale = scale;
+ }
+ }
+
+ public override void ResetFacing() => SetFacing(1f);
+
+ public override void StopMoveAnimation()
+ {
+ if (heroRectTrans != null)
+ {
+ DG.Tweening.DOTween.Kill(heroRectTrans);
+ }
+ }
+
+ public override void ShowTips(string message, bool useArtText = false, bool followCharacter = true, float scaleRatio = 1f)
+ {
+ _heroInfoBar?.ShowTips(message, useArtText, followCharacter, scaleRatio);
+ }
+
+ public override void ShowTips(BattleHeroInfoBar.TipsInfo tipsInfo)
+ {
+ _heroInfoBar?.ShowTips(tipsInfo);
+ }
+
+ // 鏈夊彉鍖栦簡鎵嶄細璋冪敤杩欎釜鍑芥暟
+ private void OnControledChange(int groupType, bool value)
+ {
+ // 杩欓噷鏄彈鍒扮‖鎺ф椂鍊� 闇�瑕佽〃鐜扮殑鍔ㄧ敾
+ if (groupType == BattleConst.HardControlGroup)
+ {
+ // 浠庢病琚‖鎺у埌琚‖鎺�
+ if (value)
+ {
+ motionBase.SetControledAnimation();
+ }
+ else
+ {
+ motionBase.CancelControledAnimation();
+ }
+ }
+ }
+
+ public override 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);
+ 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);
+ if (!IsTianziBoss())
+ {
+ heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
+ }
+ break;
+ case PlayerDataType.XP:
+ long toXp = GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
+ heroInfoBar.UpdateXP(teamHero.rage, toXp, 100);
+ teamHero.rage = (int)GeneralDefine.GetFactValue(_refreshInfo.Value, _refreshInfo.ValueEx);
+ break;
+ default:
+ Debug.LogError("BattleObject.ObjInfoRefresh 鍑虹幇鎰忓绫诲瀷 " + _refreshInfo.RefreshType.ToString());
+ break;
+ }
+ }
+
+ public override DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null)
+ {
+ DeathRecordAction recordAction = null;
+ bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
+ bool firstHit = battleHurtParam.hitIndex == 0;
+
+ // 娣诲姞璋冭瘯鏃ュ織
+ bool isHealing = BattleUtility.IsHealing(battleHurtParam.hurt);
+
+ BattleDmgInfo dmgInfo = PopDamage(battleHurtParam);
+
+ // ============ 搴旂敤鐩爣鐨勮閲忓拰鎶ょ浘鍙樺寲 ============
+ ApplyHurtToTarget(battleHurtParam, isLastHit);
+
+ // 杩欓噷
+ if (dmgInfo.IsType(DamageType.Dodge) /*&& !buffMgr.isControled[BattleConst.HardControlGroup]*/)//濡傛灉琚帶鍒朵簡杩橀棯閬夸簡 瑕佺湅鐪嬫湇鍔″櫒鎬庝箞澶勭悊浜�
+ {
+ if (isLastHit)
+ {
+ DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
+ // 銆愪娇鐢� BattleField.recordPlayer銆�
+ // 鍘熷洜锛氶棯閬垮畬鎴愬姩浣滄槸鐩爣瑙掕壊鐨勭嫭绔嬭涓猴紝涓嶆槸鎶�鑳藉唴閮ㄤ骇鐢熺殑
+ // 铏界劧鏄湪Hurt杩囩▼涓Е鍙戯紝浣嗘槸闂伩鍔ㄤ綔鏈韩鏄洰鏍囩殑鍙嶅簲锛屽簲璇ョ敱涓籖ecordPlayer绠$悊
+ // 浣跨敤InsertRecord鍙互鎻掑埌闃熷垪鏈�鍓嶉潰锛屼繚璇侀棯閬胯〃鐜扮殑浼樺厛绾�
+ battleField.recordPlayer.InsertRecord(dodgeFinish);
+ }
+
+ if (firstHit)
+ {
+ OnDodgeBegin();
+ }
+ }
+
+ bool isFatalAttack = (null != battleHurtParam.deadPack) && isLastHit;
+
+ if (isFatalAttack)
+ {
+ if (null != battleHurtParam.battleDrops)
+ {
+ PushDropItems(battleHurtParam.battleDrops);
+ }
+ recordAction = battleField.OnObjsDead(new List<BattleDeadPack>() { battleHurtParam.deadPack }, _parentSkillAction, _parentSkillAction);
+ }
+ else
+ {
+ if (dmgInfo.IsType(DamageType.Block))
+ {
+ battleField.battleEffectMgr.PlayEffect(this, BattleConst.BlockEffectID, heroRectTrans, Camp, teamHero.modelScale);
+ }
+ // else
+ // {
+ if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()))
+ {
+ if (!buffMgr.isControled[BattleConst.HardControlGroup])
+ {
+ battleField.soundManager.PlayEffectSound(teamHero.heroConfig.HitSFX, false);
+ motionBase.PlayAnimation(MotionName.hit, false);
+ }
+ }
+ // }
+ }
+
+ return recordAction;
+ }
+
+ /// <summary>
+ /// 搴旂敤鐩爣鐨勮閲忓拰鎶ょ浘鍙樺寲
+ /// </summary>
+ private void ApplyHurtToTarget(BattleHurtParam battleHurtParam, bool isLastHit)
+ {
+ BattleHurtObj hurter = battleHurtParam.hurter;
+
+ // 搴旂敤琛�閲忓彉鍖�
+ teamHero.curHp = hurter.toHp;
+
+#if UNITY_EDITOR
+ // 鏈�鍚庝竴鍑绘椂楠岃瘉琛�閲忔槸鍚︿笌鏈嶅姟鍣ㄤ竴鑷�
+ if (isLastHit)
+ {
+ BattleUtility.ValidateHpConsistency(battleHurtParam, "鐩爣鍙椾激");
+ }
+#endif
+ }
+
+ const float pingpongTime = 0.4f;
+ // 闂伩寮�濮�
+ public override void OnDodgeBegin()
+ {
+ 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.soundManager.PlayEffectSound(BattleConst.DodgeSoundID);
+
+ battleField.battleTweenMgr.OnPlayTween(tween);
+ }
+
+ // 闂伩缁撴潫
+ public override void OnDodgeEnd(Action _complete = null)
+ {
+ RectTransform rectTrans = heroRectTrans;
+
+ var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime)
+ .SetEase(Ease.OutCubic);
+
+ tween.onComplete += () =>
+ {
+ _complete?.Invoke();
+ };
+
+ battleField.battleTweenMgr.OnPlayTween(tween);
+ }
+
+ public override void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
+ {
+ buffMgr.RemoveAllBuff();
+ battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false);
+ if (withoutAnime)
+ {
+ SetDeath();
+ _onDeathAnimationComplete?.Invoke();
+ }
+ else
+ {
+ motionBase.PlayDeadAnimation(() =>
+ {
+ SetDeath();
+ _onDeathAnimationComplete?.Invoke();
+ });
+ }
+ }
+
+ public override void SetDeath()
+ {
+ teamHero.isDead = true;
+ OnDeadAnimationComplete();
+ }
+
+ protected virtual void OnDeadAnimationComplete()
+ {
+ // 鎴栬鐪嬬湅婧惰В鐗规晥锛� YYL TODO
+ heroGo.SetActive(false);
+
+ // 闃叉缁欐浜″璞″張涓奲uff
+ buffMgr.RemoveAllBuff();
+ }
+
+ // 閲婃斁鑰呭氨鏄娲昏�呮椂璋冪敤
+ public override void PreReborn(bool reviveSelf = false)
+ {
+ heroGo.SetActive(true);
+ motionBase.skeletonAnim.skeleton.A = 0f;
+ motionBase.skeletonAnim.LateUpdate();
+ heroRectTrans.anchoredPosition = Vector2.zero;
+ motionBase.ResetForReborn(reviveSelf);
+ }
+
+ // 澶嶆椿action
+ public override 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 override void AfterReborn()
+ {
+ // 娓呯┖鎵�鏈�
+ motionBase.ResetForReborn(false);
+ isReborning = false;
+ }
+
+ // 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
+ protected override BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
+ {
+ BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam);
+ // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉¢�昏緫
+ BattleObject boss = battleField.FindBoss();
+ // 淇锛歜attleHurtParam.hurtObj.ObjID -> battleHurtParam.hurter.hurtObj.ObjID
+ if (boss != null && battleField.MapID == 30020 && boss.ObjID == battleHurtParam.hurter.hurtObj.ObjID)
+ {
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
+ }
+ else
+ {
+ heroInfoBar.UpdateDamage(battleDmgInfo);
+
+ // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
+ }
+ }
+
+ /// <summary>
+ /// 涓烘柦娉曡�呭垱寤轰激瀹充俊鎭紙鍚歌/鍙嶄激锛�
+ /// </summary>
+ protected override BattleDmgInfo PopDamageForCaster(BattleHurtParam 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)
+ {
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
+ }
+ else
+ {
+ heroInfoBar.UpdateDamage(battleDmgInfo);
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
+ }
+ }
+
+ public override void HaveRest()
+ {
+ // YYL TODO
+ // 浼戞伅鐘舵��
+ // 澶氫竴涓獄zz鐨勪竴涓壒鏁�
+ heroGo.SetActive(true);
+ motionBase.HaveRest();
+ heroRectTrans.anchoredPosition = Vector2.zero;
+ heroInfoBar.HaveRest();
+ isReborning = false;
+
+ SetFront();
+ }
+ public override void SetSpeedRatio(float ratio)
+ {
+ motionBase.SetSpeedRatio(ratio);
+ heroInfoBar.SetSpeedRatio(ratio);
+ }
+ public override void PushDropItems(BattleDrops _battleDrops)
+ {
+ m_battleDrops = _battleDrops;
+ }
+
+ public override void PerformDrop()
+ {
+ if (null == m_battleDrops)
+ return;
+
+ EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
+ EventName.BATTLE_DROP_ITEMS, battleField.guid, m_battleDrops, OnPerformDropFinish);
+ }
+
+ protected override void OnPerformDropFinish()
+ {
+ m_battleDrops = null;
+ }
+
+ public override void OnObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData)
+ {
+ // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉�,涓嶆嫤鎴�掓皵
+ BattleObject boss = battleField.FindBoss();
+ if (boss != null && battleField.MapID == 30020 && boss.ObjID == vNetData.ObjID && vNetData.RefreshType != (ushort)PlayerDataType.XP)
+ return;
+
+ long diffValue = GeneralDefine.GetFactValue(vNetData.DiffValue, vNetData.DiffValueEx);
+ diffValue *= vNetData.DiffType == 0 ? -1 : 1;
+
+ long newValue = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
+
+ switch ((PlayerDataType)vNetData.RefreshType)
+ {
+ case PlayerDataType.HP:
+ long toHp = GeneralDefine.GetFactValue(vNetData.Value, vNetData.ValueEx);
+ 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;
+ if (!IsTianziBoss())
+ {
+ heroInfoBar.UpdateHP(teamHero.curHp, teamHero.curHp, teamHero.maxHp, false);
+ }
+ break;
+ case PlayerDataType.XP:
+ long toXp = newValue;
+ heroInfoBar.UpdateXP(teamHero.rage, toXp, 100);
+ teamHero.rage = (int)newValue;
+
+ DamageNumConfig damageNumConfig = DamageNumConfig.Get((int)DamageType.RageUp);
+ string message = BattleUtility.ConvertToArtFont(damageNumConfig, diffValue);
+ heroInfoBar.ShowTips(new BattleHeroInfoBar.TipsInfo()
+ {
+ message = message,
+ useArtText = true,
+ followCharacter = true,
+ scaleRatio = 1f,
+ isRage = true
+ });
+ break;
+ default:
+ Debug.LogError("BattleObject.ObjPropertyRefreshView 鍑虹幇鎰忓绫诲瀷 " + vNetData.RefreshType.ToString());
+ break;
+ }
+ }
+
+ public override void OnHurtTarget(BattleHurtParam battleHurtParam)
+ {
+ // 妫�鏌ユ槸鍚︽湁鍚歌鎴栧弽浼�
+ bool hasSuckHp = battleHurtParam.caster.suckHpList != null && battleHurtParam.caster.suckHpList.Count > 0;
+ bool hasReflectHp = battleHurtParam.caster.reflectHpList != null && battleHurtParam.caster.reflectHpList.Count > 0;
+
+ if (!hasSuckHp && !hasReflectHp)
+ {
+ return;
+ }
+
+ // ============ 搴旂敤鏂芥硶鑰呯殑琛�閲忓拰鎶ょ浘鍙樺寲 ============
+ bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
+ ApplyHurtToCaster(battleHurtParam, isLastHit);
+
+ // 鍜孒urt涓�鏍凤紝璋冪敤PopDamage澶勭悊鍚歌/鍙嶄激鐨勬樉绀�
+ BattleDmgInfo casterDmgInfo = PopDamageForCaster(battleHurtParam);
+
+ // 濡傛灉鏈夊弽浼わ紝鏂芥硶鑰呮挱鏀惧彈鍑诲姩鐢�
+ if (hasReflectHp && casterDmgInfo.casterDamageList != null && casterDmgInfo.casterDamageList.Count > 0)
+ {
+ long totalReflect = casterDmgInfo.casterDamageList.Sum(d => d.damage);
+ if (totalReflect > 0 && !buffMgr.isControled[BattleConst.HardControlGroup])
+ {
+ motionBase.PlayAnimation(MotionName.hit, false);
+ }
+ }
+ }
+
+ /// <summary>
+ /// 搴旂敤鏂芥硶鑰呯殑琛�閲忓拰鎶ょ浘鍙樺寲锛堝惛琛�鍜屽弽浼わ級
+ /// </summary>
+ private void ApplyHurtToCaster(BattleHurtParam battleHurtParam, bool isLastHit)
+ {
+ BattleCastObj caster = battleHurtParam.caster;
+
+ // 搴旂敤琛�閲忓彉鍖�
+ teamHero.curHp = caster.toHp;
+
+#if UNITY_EDITOR
+ // 鏈�鍚庝竴鍑绘椂楠岃瘉琛�閲忔槸鍚︿笌鏈嶅姟鍣ㄤ竴鑷�
+ if (isLastHit)
+ {
+ BattleUtility.ValidateHpConsistencyForCaster(battleHurtParam, "鏂芥硶鑰呭惛琛�/鍙嶄激");
+ }
+#endif
+ }
+
+#if UNITY_EDITOR_STOP_USING
+ public override void EditorRevive()
+ {
+ teamHero.curHp = 100;
+ heroGo.SetActive(true);
+ motionBase.PlayAnimation(MotionName.idle, true);
+ }
+#endif
+
+ protected override void OnPlayHitAnimation()
+ {
+ motionBase.PlayAnimation(MotionName.hit, false);
+ }
+}
diff --git a/Main/System/Battle/BattleObject/HeroBattleObject.cs.meta b/Main/System/Battle/BattleObject/HeroBattleObject.cs.meta
new file mode 100644
index 0000000..ef564be
--- /dev/null
+++ b/Main/System/Battle/BattleObject/HeroBattleObject.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 358b6cdb61b081c4b9e766c10ae885af
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/BattleObject/MinggeBattleObject.cs b/Main/System/Battle/BattleObject/MinggeBattleObject.cs
new file mode 100644
index 0000000..c575e93
--- /dev/null
+++ b/Main/System/Battle/BattleObject/MinggeBattleObject.cs
@@ -0,0 +1,157 @@
+
+using System;
+using UnityEngine;
+using Spine.Unity;
+
+/// <summary>
+/// 鍛芥牸鎴樻枟瀵硅薄 - 娌℃湁琛�閲忋�佹病鏈夊疄浣擄紝涓嶄細琚敾鍑诲拰閫変腑锛屽敮涓�浣滅敤鏄噴鏀炬妧鑳�
+/// </summary>
+public class MinggeBattleObject : BattleObject
+{
+ public MinggeBattleObject(BattleField _battleField) : base(_battleField)
+ {
+ }
+
+ public override void Init(TeamHero _teamHero, BattleCamp _camp)
+ {
+ teamHero = _teamHero;
+ Camp = _camp;
+
+ // 鍛芥牸鍙渶瑕� buff 绠$悊鍣ㄧ敤浜庢妧鑳芥晥鏋�
+ buffMgr = new BattleObjectBuffMgr();
+ buffMgr.Init(this);
+
+ layerMgr = new BattleObjectLayerMgr();
+ layerMgr.Init(this);
+ }
+
+ public override void Run()
+ {
+ // 鍛芥牸杩愯閫昏緫锛堝鏋滈渶瑕侊級
+ }
+
+ public override void Pause()
+ {
+ // 鍛芥牸鏆傚仠
+ }
+
+ public override void Resume()
+ {
+ // 鍛芥牸鎭㈠
+ }
+
+ public override void Destroy()
+ {
+ if (buffMgr != null)
+ {
+ buffMgr.Release();
+ }
+ }
+
+ // ============ 鍔ㄧ敾鐩稿叧鏂规硶瀹炵幇锛堝懡鏍兼病鏈夊姩鐢伙級 ============
+
+ public override void PlayAnimation(MotionName motionName, bool loop)
+ {
+ // 鍛芥牸娌℃湁鍔ㄧ敾
+ }
+
+ public override void ShowIllusionShadow(bool show, Color? color = null)
+ {
+ // 鍛芥牸娌℃湁骞诲奖
+ }
+
+ public override Spine.TrackEntry PlaySkillAnimation(SkillConfig skillConfig, SkillBase skillBase, bool isCounter, Action onComplete)
+ {
+ // 鍛芥牸娌℃湁鎶�鑳藉姩鐢伙紝鐩存帴瀹屾垚
+ onComplete?.Invoke();
+ return null;
+ }
+
+ public override bool CanStartDeath()
+ {
+ // 鍛芥牸涓嶄細姝讳骸
+ return false;
+ }
+
+ public override bool CanCastSkillAnimation(SkillConfig skillConfig)
+ {
+ // 鍛芥牸鎬绘槸鍙互閲婃斁鎶�鑳斤紙浠庡姩鐢昏搴︼級
+ return true;
+ }
+
+ public override SkeletonAnimation GetSkeletonAnimation()
+ {
+ // 鍛芥牸娌℃湁楠ㄩ鍔ㄧ敾
+ return null;
+ }
+
+ public override void SetSkeletonAlpha(float alpha)
+ {
+ // 鍛芥牸娌℃湁楠ㄩ鍔ㄧ敾
+ }
+
+ // ============ 浠ヤ笅鏂规硶鍛芥牸涓嶉渶瑕侊紝浣嗗繀椤诲疄鐜版帴鍙� ============
+
+ public override DeathRecordAction Hurt(BattleHurtParam battleHurtParam, SkillRecordAction _parentSkillAction = null)
+ {
+ // 鍛芥牸涓嶄細琚敾鍑�
+ Debug.LogWarning("鍛芥牸涓嶅簲璇ヨ鏀诲嚮");
+ return null;
+ }
+
+ public override void OnDodgeBegin()
+ {
+ // 鍛芥牸涓嶉渶瑕侀棯閬�
+ }
+
+ public override void OnDodgeEnd(Action _complete = null)
+ {
+ // 鍛芥牸涓嶉渶瑕侀棯閬�
+ _complete?.Invoke();
+ }
+
+ public override void OnDeath(Action _onDeathAnimationComplete, bool withoutAnime = false)
+ {
+ // 鍛芥牸娌℃湁姝讳骸
+ _onDeathAnimationComplete?.Invoke();
+ }
+
+ protected override BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
+ {
+ // 鍛芥牸涓嶆樉绀轰激瀹�
+ return null;
+ }
+
+ protected override BattleDmgInfo PopDamageForCaster(BattleHurtParam battleHurtParam)
+ {
+ // 鍛芥牸涓嶆樉绀轰激瀹�
+ return null;
+ }
+
+ public override void HaveRest()
+ {
+ // 鍛芥牸涓嶉渶瑕佷紤鎭姸鎬�
+ }
+
+ public override void SetSpeedRatio(float ratio)
+ {
+ // 鍛芥牸涓嶉渶瑕侀�熷害鎺у埗
+ }
+
+ public override void OnObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData)
+ {
+ // 鍛芥牸娌℃湁琛�閲忥紝涓嶉渶瑕佸睘鎬у埛鏂�
+ }
+
+#if UNITY_EDITOR_STOP_USING
+ public override void EditorRevive()
+ {
+ // 鍛芥牸涓嶉渶瑕佸娲�
+ }
+#endif
+
+ protected override void OnPlayHitAnimation()
+ {
+ // 鍛芥牸涓嶉渶瑕佸彈鍑诲姩鐢�
+ }
+}
diff --git a/Main/System/Battle/BattleObject/MinggeBattleObject.cs.meta b/Main/System/Battle/BattleObject/MinggeBattleObject.cs.meta
new file mode 100644
index 0000000..278bc3c
--- /dev/null
+++ b/Main/System/Battle/BattleObject/MinggeBattleObject.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a8a19a09ccd7bc445af39c15aa3e343f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
index d1ded5f..51420d4 100644
--- a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
+++ b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
@@ -61,7 +61,7 @@
return;
}
int[] effectPos = effectPlayer.effectConfig.effectPos;
- effectPlayer.transform.position = battleObject.heroRectTrans.position;
+ effectPlayer.transform.position = battleObject.GetPosition();
if (null != effectPos && effectPos.Length >= 2)
{
effectPlayer.rectTrans.anchoredPosition += new Vector2(effectPos[0], effectPos[1]);
@@ -297,7 +297,7 @@
else
{
BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr
- .PlayEffect(battleObject, skillConfig.BuffEffect, battleObject.heroRectTrans, battleObject.Camp, battleObject.teamHero.modelScale);
+ .PlayEffect(battleObject, skillConfig.BuffEffect, battleObject.GetRectTransform(), battleObject.Camp, battleObject.teamHero.modelScale);
effect.BindBone(battleObject, effect.effectConfig.nodeName);
@@ -321,7 +321,7 @@
UpdateControlState();
- battleObject.heroInfoBar.RefreshBuff(buffDataDict.Values.ToList());
+ battleObject.RefreshBuff(buffDataDict.Values.ToList());
onBuffChanged?.Invoke();
// bool isUnderControl = false;
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index b501bfb..501e71f 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -225,13 +225,13 @@
if (change)
{
MoveSpeed = 1125f;
- caster.motionBase.ShowIllusionShadow(true, color);
+ caster.ShowIllusionShadow(true, color);
}
}
else
{
MoveSpeed = 750f;
- caster.motionBase.ShowIllusionShadow(false);
+ caster.ShowIllusionShadow(false);
}
}
@@ -303,7 +303,7 @@
{
if (hintConfig != null)
{
- battleObject.heroInfoBar.ShowTips(((char)hintConfig.prefix).ToString(), true, false, 1.25f);
+ battleObject.ShowTips(((char)hintConfig.prefix).ToString(), true, false, 1.25f);
}
}
@@ -427,10 +427,10 @@
return;
}
- caster.motionBase.PlayAnimation(MotionName.run, true);
- var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, () =>
+ caster.PlayAnimation(MotionName.run, true);
+ var tweener = BattleUtility.MoveToTarget(caster.GetRectTransform(), target, offset, () =>
{
- caster.motionBase.PlayAnimation(MotionName.idle, true);
+ caster.PlayAnimation(MotionName.idle, true);
_onComplete?.Invoke();
}, speed);
battleField.battleTweenMgr.OnPlayTween(tweener);
@@ -441,9 +441,7 @@
{
if (skillConfig.CastDistance < 0)
{
- Vector3 scale = caster.heroGo.transform.localScale;
- scale.x = Mathf.Abs(scale.x) * forward;
- caster.heroGo.transform.localScale = scale;
+ caster.SetFacing(forward);
}
_onComplete?.Invoke();
}
@@ -453,7 +451,7 @@
{
TurnBack(null, 1f);
OnAllAttackMoveFinished();
- caster.motionBase.PlayAnimation(MotionName.idle, true);
+ caster.PlayAnimation(MotionName.idle, true);
}
// 鎵�鏈夋敾鍑荤Щ鍔ㄥ畬鎴愬悗鐨勫鐞嗭細鎭㈠UI鏄剧ず鐘舵��
@@ -464,7 +462,7 @@
foreach (BattleObject bo in allList)
{
bo.layerMgr.SetFront();
- bo.heroInfoBar.SetActive(true);
+ bo.GetHeroInfoBar()?.SetActive(true);
}
battleField.battleRootNode.skillMaskNode.SetActive(false);
}
@@ -472,7 +470,7 @@
// 鎵ц鎶�鑳介噴鏀惧姩鐢诲拰閫昏緫锛氭挱鏀炬柦娉曞姩浣滃苟鎻愪緵鍥炶皟
protected TrackEntry CastImpl(Action onComplete = null)
{
- return caster.motionBase.PlaySkillAnimation(skillConfig, this, tagUseSkillAttack.BattleType == 4, onComplete);
+ return caster.PlaySkillAnimation(skillConfig, this, tagUseSkillAttack.BattleType == 4, onComplete);
}
// 鎶�鑳藉紑濮嬪洖璋冿細澶勭悊姝讳骸銆佸瓙鎶�鑳姐�佹妧鑳芥晥鏋滃垵濮嬪寲
@@ -656,7 +654,7 @@
var highlightSet = new HashSet<BattleObject>(highlightList);
// 鍏堟妸鏂芥硶鑰呯殑 InfoBar 闅愯棌锛堝師閫昏緫淇濈暀锛�
- caster.heroInfoBar.SetActive(false);
+ caster.GetHeroInfoBar()?.SetActive(false);
foreach (BattleObject bo in allList)
{
@@ -673,7 +671,7 @@
}
// 鐩爣锛堝惈 HurtListEx锛夐兘搴旀樉绀� InfoBar
- bo.heroInfoBar.SetActive(isTarget);
+ bo.GetHeroInfoBar()?.SetActive(isTarget);
}
battleField.battleRootNode.skillMaskNode.SetActive(true);
@@ -790,7 +788,7 @@
DamageNumConfig hintConfig = DamageNumConfig.Get(BattleConst.BreakArmor);
Hint(battleObject, hintConfig);
battleField.battleEffectMgr.PlayEffect(battleObject,
- BattleConst.BreakArmorEffectID, battleObject.heroRectTrans, battleObject.Camp,
+ BattleConst.BreakArmorEffectID, battleObject.GetRectTransform(), battleObject.Camp,
battleObject.teamHero.modelScale);
}
}
@@ -802,7 +800,7 @@
DamageNumConfig hintConfig = DamageNumConfig.Get(BattleConst.Parry);
Hint(battleObject, hintConfig);
battleField.battleEffectMgr.PlayEffect(battleObject,
- BattleConst.ParryEffectID, battleObject.heroRectTrans, battleObject.Camp,
+ BattleConst.ParryEffectID, battleObject.GetRectTransform(), battleObject.Camp,
battleObject.teamHero.modelScale);
}
}
@@ -1022,7 +1020,7 @@
BattleDrops battleDrops = new BattleDrops()
{
- rectTransform = deadTarget.heroRectTrans,
+ rectTransform = deadTarget.GetRectTransform(),
dropItemPackIndex = itemIndexList,
expDrops = expAssign[i]
};
@@ -1323,30 +1321,22 @@
}
// 3. 娓呯悊 DOTween 鍔ㄧ敾锛堥槻姝㈢Щ鍔ㄥ洖璋冨湪鎴樻枟缁撴潫鍚庢墽琛岋級
- if (caster != null && caster.heroRectTrans != null)
+ if (caster != null)
{
- DG.Tweening.DOTween.Kill(caster.heroRectTrans);
+ caster.StopMoveAnimation();
}
// 4. 閲嶇疆鏂芥硶鑰呯姸鎬�
if (caster != null)
{
// 閲嶇疆浣嶇疆鍒板師鐐�
- if (caster.heroRectTrans != null)
- {
- caster.heroRectTrans.anchoredPosition = Vector2.zero;
- }
+ caster.ResetPosition();
// 閲嶇疆鏈濆悜
- if (caster.heroGo != null)
- {
- Vector3 scale = caster.heroGo.transform.localScale;
- scale.x = Mathf.Abs(scale.x);
- caster.heroGo.transform.localScale = scale;
- }
+ caster.ResetFacing();
// 鍙栨秷骞诲奖鏁堟灉
- caster.motionBase?.ShowIllusionShadow(false);
+ caster.ShowIllusionShadow(false);
}
// 5. 鎭㈠ UI 鐘舵��
@@ -1359,7 +1349,7 @@
foreach (BattleObject bo in allList)
{
bo.layerMgr?.SetFront();
- bo.heroInfoBar?.SetActive(true);
+ bo.GetHeroInfoBar()?.SetActive(true);
}
}
diff --git a/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs b/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
index bf3f071..4e34c5d 100644
--- a/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
+++ b/Main/System/Battle/SkillEffect/BulletCurve/BounceBulletCurve.cs
@@ -64,7 +64,16 @@
var nextTargetObj = caster.battleField.battleObjMgr.GetBattleObject((int)hurtList[curIndex].ObjID);
if (nextTargetObj != null && !nextTargetObj.IsDead())
{
- end = WorldToLocalAnchoredPosition(nextTargetObj.heroRectTrans.position);
+ RectTransform targetRect = nextTargetObj.GetRectTransform();
+ if (targetRect != null)
+ {
+ end = WorldToLocalAnchoredPosition(targetRect.position);
+ }
+ else
+ {
+ BattleDebug.LogError("寮瑰皠鐩爣娌℃湁RectTransform");
+ end = start;
+ }
}
else
{
diff --git a/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs b/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
index 5ce711f..77e2fad 100644
--- a/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
+++ b/Main/System/Battle/SkillEffect/BulletCurve/BulletCurve.cs
@@ -34,14 +34,15 @@
this.hurts = hurtList;
this.mBulletIndex = bulletIndex;
- // 璁剧疆bulletTrans鍧愭爣涓篶aster.heroRectTrans鐨勪笘鐣屽潗鏍囪浆鎹㈠埌bulletTrans鐖惰妭鐐逛笅鐨勬湰鍦板潗鏍�
- if (bulletTrans != null && caster.heroRectTrans != null)
+ // 璁剧疆bulletTrans鍧愭爣涓篶aster鐨勪笘鐣屽潗鏍囪浆鎹㈠埌bulletTrans鐖惰妭鐐逛笅鐨勬湰鍦板潗鏍�
+ RectTransform casterRect = caster.GetRectTransform();
+ if (bulletTrans != null && casterRect != null)
{
var parent = bulletTrans.parent as RectTransform;
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(
parent,
- RectTransformUtility.WorldToScreenPoint(null, caster.heroRectTrans.position),
+ RectTransformUtility.WorldToScreenPoint(null, casterRect.position),
null,
out localPoint);
bulletTrans.anchoredPosition = localPoint;
diff --git a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
index ee71f5e..e5e7f6d 100644
--- a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
@@ -172,7 +172,7 @@
private void ShotToIndex(BattleCamp camp, int targetIndex, int bulletIndex)
{
RectTransform targetTransform = caster.battleField.GetTeamNode(camp, targetIndex);
- BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp, caster.teamHero.modelScale);
+ BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.GetRectTransform(), caster.Camp, caster.teamHero.modelScale);
RectTransform effectTrans = effectPlayer.transform as RectTransform;
@@ -198,8 +198,8 @@
continue;
}
- PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
}
// 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
@@ -328,7 +328,7 @@
private void ScatterShot(BattleObject target, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, int bulletIndex, int order)
{
- BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp, caster.teamHero.modelScale);
+ BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.GetRectTransform(), caster.Camp, caster.teamHero.modelScale);
bool shotToSelf = target.ObjID == caster.ObjID;
@@ -336,7 +336,7 @@
var tempOrder = order;
- var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans,
+ var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.GetRectTransform(),
new List<HB427_tagSCUseSkill.tagSCUseSkillHurt> { hurt }, bulletIndex, (index, hitList) =>
{
foreach (var hurt in hitList)
@@ -348,10 +348,10 @@
continue;
}
- PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
}
// 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
@@ -374,7 +374,7 @@
protected void ShotToTarget(BattleObject target, int bulletIndex)
{
- BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp, caster.teamHero.modelScale);
+ BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.BulletEffectId, caster.GetRectTransform(), caster.Camp, caster.teamHero.modelScale);
bool shotToSelf = target.ObjID == caster.ObjID;
@@ -384,7 +384,7 @@
int tempBulletIndex = bulletIndex;
- var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack.HurtList.ToList(), bulletIndex, (index, hitList) =>
+ var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.GetRectTransform(), tagUseSkillAttack.HurtList.ToList(), bulletIndex, (index, hitList) =>
{
if (skillConfig.BulletPath == 4)
{
@@ -396,10 +396,10 @@
BattleObject targetObj = caster.battleField.battleObjMgr.GetBattleObject((int)hurt.ObjID);
if (targetObj != null)
{
- PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
}
else
{
@@ -433,10 +433,10 @@
continue;
}
- PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
- PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.heroGo.transform, caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffectId, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect2, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect3, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
+ PlayExplosionEffect(skillConfig.ExplosionEffect4, targetObj.GetTransform(), caster.Camp, targetObj.teamHero.modelScale);
}
// 琛ㄧ幇瀛愬脊椋炶鍒扮洰鏍囦綅缃�
diff --git a/Main/System/Battle/SkillEffect/DotSkillEffect.cs b/Main/System/Battle/SkillEffect/DotSkillEffect.cs
index 1ee81b9..8acbe08 100644
--- a/Main/System/Battle/SkillEffect/DotSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/DotSkillEffect.cs
@@ -31,7 +31,7 @@
Debug.LogError($"DotSkillEffect 鎵句笉鍒扮洰鏍囷紝GUID={hurtInfo.ObjID}");
continue;
}
- target.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.TriggerEffect, target.heroRectTrans, caster.Camp, target.teamHero.modelScale);
+ target.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.TriggerEffect, target.GetRectTransform(), caster.Camp, target.teamHero.modelScale);
}
onHit?.Invoke(0, tagUseSkillAttack.HurtList.ToList());
diff --git a/Main/System/Battle/SkillEffect/NoEffect.cs b/Main/System/Battle/SkillEffect/NoEffect.cs
index 288f87b..a473f36 100644
--- a/Main/System/Battle/SkillEffect/NoEffect.cs
+++ b/Main/System/Battle/SkillEffect/NoEffect.cs
@@ -50,11 +50,11 @@
if (skillConfig.ExplosionEffect3 > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect3, target.heroGo.transform, caster.Camp, target.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect3, target.GetTransform(), caster.Camp, target.teamHero.modelScale);
}
if (skillConfig.ExplosionEffect4 > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect4, target.heroGo.transform, caster.Camp, target.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect4, target.GetTransform(), caster.Camp, target.teamHero.modelScale);
}
}
diff --git a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
index 97e9dd7..a8ee564 100644
--- a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
@@ -49,11 +49,11 @@
if (skillConfig.ExplosionEffect3 > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect3, target.heroGo.transform, caster.Camp, target.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect3, target.GetTransform(), caster.Camp, target.teamHero.modelScale);
}
if (skillConfig.ExplosionEffect4 > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect4, target.heroGo.transform, caster.Camp, target.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(target, skillConfig.ExplosionEffect4, target.GetTransform(), caster.Camp, target.teamHero.modelScale);
}
}
diff --git a/Main/System/Battle/SkillEffect/SkillEffect.cs b/Main/System/Battle/SkillEffect/SkillEffect.cs
index e0d4e11..e0ffdd3 100644
--- a/Main/System/Battle/SkillEffect/SkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/SkillEffect.cs
@@ -29,11 +29,11 @@
onHit = _onHit;
if (skillConfig.EffectId > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId, caster.heroRectTrans, caster.Camp, caster.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId, caster.GetRectTransform(), caster.Camp, caster.teamHero.modelScale);
}
if (skillConfig.EffectId2 > 0)
{
- caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId2, caster.heroRectTrans, caster.Camp, caster.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.EffectId2, caster.GetRectTransform(), caster.Camp, caster.teamHero.modelScale);
}
}
@@ -52,7 +52,7 @@
if (skillConfig.MStartEffectId <= 0)
return;
// 涓憞鍥哄畾鐗规晥
- caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.MStartEffectId, caster.heroGo.transform, caster.Camp, caster.teamHero.modelScale);
+ caster.battleField.battleEffectMgr.PlayEffect(caster, skillConfig.MStartEffectId, caster.GetTransform(), caster.Camp, caster.teamHero.modelScale);
}
/// <summary>
diff --git a/Main/System/Battle/TianziBillboradBattleWin.cs b/Main/System/Battle/TianziBillboradBattleWin.cs
index 4d1391b..336dcec 100644
--- a/Main/System/Battle/TianziBillboradBattleWin.cs
+++ b/Main/System/Battle/TianziBillboradBattleWin.cs
@@ -132,7 +132,7 @@
private void OnStageUp(int stage)
{
- GameObject hero = bossBattleObject.heroGo;
+ GameObject hero = bossBattleObject.GetGameObject();
if (hero == null || stage <= 1)
return;
@@ -244,20 +244,20 @@
private void OnValueChangeAction(float nowValue, int CurrentStage)
{
- if (bossBattleObject == null || bossBattleObject.heroInfoBar == null)
+ if (bossBattleObject == null)
return;
- bossBattleObject.heroInfoBar.UpdateHP(nowValue);
+ bossBattleObject.UpdateHP(nowValue);
//Debug.Log($"TianziDamageBar nowValue {nowValue} 鏃堕棿: {DateTime.Now:HH:mm:ss}");
}
private void OnChangeEndAction(ulong nowHunt, ulong nowHpMax)
{
- if (bossBattleObject == null || bossBattleObject.heroInfoBar == null)
+ if (bossBattleObject == null)
return;
if (nowHpMax > 0)
{
float percentage = Mathf.Clamp(nowHunt, 0, nowHpMax) / (float)nowHpMax;
- bossBattleObject.heroInfoBar.UpdateHP(percentage);
+ bossBattleObject.UpdateHP(percentage);
//Debug.Log($"TianziDamageBar nowValue {percentage} 鏃堕棿: {DateTime.Now:HH:mm:ss}");
}
}
--
Gitblit v1.8.0