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("修改图片宽度"); }