| | 1 | | using DCL.Helpers; |
| | 2 | | using System; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCLServices.MapRendererV2.MapLayers.HomePoint |
| | 6 | | { |
| | 7 | | internal class HomePointMarker : IHomePointMarker |
| | 8 | | { |
| | 9 | | private readonly HomePointMarkerObject markerObject; |
| | 10 | |
|
| | 11 | | private readonly float baseScale; |
| | 12 | |
|
| 96 | 13 | | public HomePointMarker(HomePointMarkerObject markerObject) |
| | 14 | | { |
| 96 | 15 | | this.markerObject = markerObject; |
| 96 | 16 | | baseScale = markerObject.transform.localScale.x; |
| 96 | 17 | | } |
| | 18 | |
|
| | 19 | | public void Dispose() |
| | 20 | | { |
| 0 | 21 | | Utils.SafeDestroy(markerObject); |
| 0 | 22 | | } |
| | 23 | |
|
| | 24 | | public void SetPosition(Vector3 position) |
| | 25 | | { |
| 0 | 26 | | markerObject.transform.localPosition = position; |
| 0 | 27 | | } |
| | 28 | |
|
| | 29 | | public void SetActive(bool active) |
| | 30 | | { |
| 184 | 31 | | markerObject.gameObject.SetActive(active); |
| 184 | 32 | | } |
| | 33 | |
|
| | 34 | | public void SetZoom(float baseZoom, float zoom) |
| | 35 | | { |
| 0 | 36 | | float newScale = Math.Max(zoom / baseZoom * baseScale, baseScale); |
| 0 | 37 | | markerObject.transform.localScale = new Vector3(newScale, newScale, 1f); |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | public void ResetToBaseScale() |
| | 41 | | { |
| 0 | 42 | | markerObject.transform.localScale = new Vector3(baseScale, baseScale, 1f); |
| 0 | 43 | | } |
| | 44 | | } |
| | 45 | | } |