完善编辑器

This commit is contained in:
tangbin
2025-07-19 12:48:11 +08:00
parent 2df2efaa3e
commit b8b50ec90b
27 changed files with 360 additions and 124 deletions

View File

@@ -53,4 +53,16 @@ public partial class MapManager : MonoBehaviour
newPosition.y = Mathf.Clamp(y, 0, mapRealHeight);
Camera.main.transform.position = new Vector3(x, y, -10);
}
public Vector2Int GetCameraPos()
{
Vector2Int pos = new Vector2Int();
pos.x = (int)Camera.main.transform.position.x;
pos.y = (int)Camera.main.transform.position.y;
pos.x = Mathf.Clamp(pos.x, 0, (int)mapRealWidth);
pos.y = Mathf.Clamp(pos.y, 0, (int)mapRealHeight);
pos.x = (int)(pos.x / map.sideWidth);
pos.y = (int)(pos.y / map.sideHeight);
return pos;
}
}