我有一块微薄的地图(Tl),当火箭击中它时,某些半径的碎片应当销毁。
我曾试图利用GetTilesBlock和Destroy功能,但我没有工作。
public void OnCollisionEnter2D(Collision2D collision)
{
int posx = (int)transform.position.x;
int posy = (int)transform.position.y;
int posz = (int)transform.position.z;
Vector3Int pos = new Vector3Int(posx, posy, posz);
Vector3Int radiusBox = new Vector3Int(3, 3, 3);
BoundsInt Box = new BoundsInt(pos, radiusBox);
TileBase[] tiles = Tl.GetTilesBlock(Box);
foreach(TileBase x in tiles)
{
Destroy(x);
}
Destroy(gameObject);
}