1、Unity拼图游戏
图片互换:
if (Vector2.Distance(btn_Rect.anchoredPosition,null_Img.anchoredPosition)==bg_Layout.cellSize.x+bg_Layout.spacing.x)
{
print("与空图片相近,点击图片的按钮的图片和空图片的Sprit图片 相互替换");
Sprite huanCun = btn_Rect.GetComponent().sprite;
btn_Rect.GetComponent().sprite = null_Img.GetComponent().sprite;
btn_Rect.gameObject.name = null_Img.gameObject.name;
null_Img.GetComponent().sprite = huanCun;
1