矩形攻击范围
This commit is contained in:
parent
9f99fc3d56
commit
b57312f05f
@ -360,9 +360,10 @@ private void GenerateBullet(float angle, Vector2 startPos, Vector2 changePos)//
|
|||||||
|
|
||||||
// 计算缩放因子,使得图片的直径与碰撞体的直径匹配
|
// 计算缩放因子,使得图片的直径与碰撞体的直径匹配
|
||||||
characterClick.OrSizeX = role.AttackRange * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
|
characterClick.OrSizeX = role.AttackRange * 2f / characterClick.StartSizeX; // * 2f 因为 radius 是半径,图片的尺寸通常是直径
|
||||||
|
characterClick.OrSizeY = characterClick.OrSizeX;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(attackColliderBox)
|
else if(attackColliderBox)
|
||||||
{
|
{
|
||||||
@ -380,6 +381,10 @@ private void GenerateBullet(float angle, Vector2 startPos, Vector2 changePos)//
|
|||||||
|
|
||||||
//float originalWidth = attackRangeSprite.bounds.size.x;
|
//float originalWidth = attackRangeSprite.bounds.size.x;
|
||||||
//attackRangeSprite.transform.localScale = new Vector3(boxSize.x*1.4f/4, boxSize.y, 1f);
|
//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("修改图片宽度");
|
Debug.Log("修改图片宽度");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user