diff --git a/Role/Attack.cs b/Role/Attack.cs index cc84d7a..82b6288 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -236,9 +236,9 @@ public class Attack : MonoBehaviour case 3: // 生成三个子弹:一个不旋转,一个向上旋转30度,一个向下旋转30度 - GenerateBullet(-35f, BulletStartPos.position, new Vector2(0, -0.25f),dir); + GenerateBullet(-35f, BulletStartPos.position, new Vector2(0, -0.25f*dir),dir); GenerateBullet(0f, BulletStartPos.position, new Vector2(0, 0),dir); - GenerateBullet(35f, BulletStartPos.position, new Vector2(0, 0.25f),dir); + GenerateBullet(35f, BulletStartPos.position, new Vector2(0, 0.25f*dir),dir); break; default: @@ -266,7 +266,7 @@ public class Attack : MonoBehaviour if (role.AttackRange / 2 > 1) { float offsetX = 0; - bulletGameObj.transform.localScale = new Vector2(role.AttackRange / 2, role.AttackRange / 3); + bulletGameObj.transform.localScale = new Vector2(role.AttackRange / 2*dir, role.AttackRange / 3); // 计算新的子弹宽度 float newWidth = bulletGameObj.GetComponentInChildren().bounds.size.x; @@ -285,10 +285,10 @@ public class Attack : MonoBehaviour offsetX = (newWidth - originalWidth) / 2; if (offsetX > 0) { - offsetX += 0.15f*dir; + offsetX += 0.15f; } // 调整子弹的位置,确保左边界不变 - bulletGameObj.transform.position = new Vector2(originalPosition.x + offsetX, originalPosition.y); + bulletGameObj.transform.position = new Vector2(originalPosition.x + offsetX*dir, originalPosition.y); } // 添加位置微调