From 6a10188f3eddc740b9b8b1e7eefb0e2fdb3850e3 Mon Sep 17 00:00:00 2001 From: yyl <yyl> Date: 星期一, 15 九月 2025 19:41:19 +0800 Subject: [PATCH] 125 【战斗】战斗系统 角色层级&战斗速度调整 --- Main/System/Battle/BattleObject/BattleObject.cs | 38 +++++++++++++------------------------- 1 files changed, 13 insertions(+), 25 deletions(-) diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs index d086b64..ecef462 100644 --- a/Main/System/Battle/BattleObject/BattleObject.cs +++ b/Main/System/Battle/BattleObject/BattleObject.cs @@ -32,6 +32,8 @@ public BattleObjectBuffMgr buffMgr; + public BattleObjectLayerMgr layerMgr; + public int ObjID { get; set; } public BattleCamp Camp { get; protected set; } @@ -65,8 +67,6 @@ } } - public int sortingOrder = 0; - protected Action onDeathAnimationComplete; protected Renderer[] renderers; @@ -89,6 +89,9 @@ buffMgr = new BattleObjectBuffMgr(); buffMgr.Init(this); + layerMgr = new BattleObjectLayerMgr(); + layerMgr.Init(this); + renderers = heroGo.GetComponentsInChildren<Renderer>(true); heroInfoBar = heroGo.GetComponentInChildren<BattleHeroInfoBar>(true); @@ -100,7 +103,7 @@ heroInfoBar.transform.localScale = heroInfoBarScale; heroInfoBar.SetActive(true); - SetToFront(); + SetFront(); } @@ -389,7 +392,7 @@ heroRectTrans.anchoredPosition = Vector2.zero; heroInfoBar.SetActive(false); - SetToFront(); + SetFront(); } public void PushDropItems(BattleDrops _battleDrops) @@ -411,34 +414,19 @@ battleDrops = null; } - public void SetToBack() + public void SetBack() { - sortingOrder = BattleConst.UnactiveHeroSortingOrder; - UpdateSortingOrder(); + layerMgr.SetBack(); } - public void SetToFront() + public void SetFront() { - sortingOrder = BattleConst.ActiveHeroSortingOrder; - UpdateSortingOrder(); + layerMgr.SetFront(); } - private void UpdateSortingOrder() + public void SetSpeedRatio(float ratio) { - if (null == renderers) return; - - foreach (var renderer in renderers) - { - if (renderer != null) - { - renderer.sortingOrder = sortingOrder; - } - } - } - - public int GetSortingOrder() - { - return sortingOrder; + motionBase.SetSpeedRatio(ratio); } -- Gitblit v1.8.0