完善编辑器
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user