From b57312f05f927e5c61bec0e2c97847fac8116c4d Mon Sep 17 00:00:00 2001 From: GL <2365963573@qq.com> Date: Sat, 28 Dec 2024 16:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=A9=E5=BD=A2=E6=94=BB=E5=87=BB=E8=8C=83?= =?UTF-8?q?=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Role/Attack.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Role/Attack.cs b/Role/Attack.cs index 4da1481..bdd90df 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -360,9 +360,10 @@ private void GenerateBullet(float angle, Vector2 startPos, Vector2 changePos)// // 计算缩放因子,使得图片的直径与碰撞体的直径匹配 characterClick.OrSizeX = role.AttackRange * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径 - + characterClick.OrSizeY = characterClick.OrSizeX; + + - } else if(attackColliderBox) { @@ -380,6 +381,10 @@ private void GenerateBullet(float angle, Vector2 startPos, Vector2 changePos)// //float originalWidth = attackRangeSprite.bounds.size.x; //attackRangeSprite.transform.localScale = new Vector3(boxSize.x*1.4f/4, boxSize.y, 1f); + characterClick.OrSizeX = boxSize.x / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径 + characterClick.OrSizeY = boxSize.y*2 / characterClick.StartSizeY; + attackRangeSprite.transform.position = new Vector2(attackRangeSprite.transform.position.x - (characterClick.StartSizeX - characterClick.OrSizeX) / 2, attackRangeSprite.transform.position.y); + //characterClick.OrSizeY = 1; Debug.Log("修改图片宽度"); }