| | 1 | | using DCLServices.MapRendererV2.MapLayers; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCLServices.MapRendererV2.CoordsUtils |
| | 5 | | { |
| | 6 | | internal static class CoordsExtensions |
| | 7 | | { |
| | 8 | | public static Vector3 PivotPosition(this ICoordsUtils coordsUtils, IMapRendererMarker marker, Vector3 objPositio |
| | 9 | | { |
| 0 | 10 | | Vector2 obj2dPos = objPosition; |
| 0 | 11 | | obj2dPos -= (Vector2.one - marker.Pivot) * coordsUtils.ParcelSize; |
| 0 | 12 | | return new Vector3(obj2dPos.x, obj2dPos.y, objPosition.z); |
| | 13 | | } |
| | 14 | |
|
| | 15 | | /// <summary> |
| | 16 | | /// Translates Coords into position and makes an offset according to the object's pivot |
| | 17 | | /// </summary> |
| | 18 | | public static Vector3 CoordsToPosition(this ICoordsUtils coordsUtils, Vector2Int coords, IMapRendererMarker mark |
| 0 | 19 | | coordsUtils.PivotPosition(marker, coordsUtils.CoordsToPosition(coords)); |
| | 20 | |
|
| | 21 | | public static void SetObjectScale(this ICoordsUtils coordsUtils, MonoBehaviour obj) |
| | 22 | | { |
| 25969 | 23 | | var parcelSize = coordsUtils.ParcelSize; |
| 25969 | 24 | | obj.transform.localScale = new Vector3(parcelSize, parcelSize, 1); |
| 25969 | 25 | | } |
| | 26 | | } |
| | 27 | | } |