private static Rectangle AdjustExclusionAreaForThisDevice(ExclusionArea exclusionArea) { var thisDeviceScale = GetScreenScalingFactor(); return(new Rectangle( (int)(exclusionArea.Area.X / exclusionArea.ScaleFactor * thisDeviceScale), (int)(exclusionArea.Area.Y / exclusionArea.ScaleFactor * thisDeviceScale), (int)(exclusionArea.Area.Width / exclusionArea.ScaleFactor * thisDeviceScale), (int)(exclusionArea.Area.Height / exclusionArea.ScaleFactor * thisDeviceScale))); }
/// <summary> /// Constructor /// </summary> /// <param name="markerPrefab">prefab for markers</param> /// <param name="overlayContainer">parent for markers</param> /// <param name="maxMarkers">max amount of markers (pool)</param> /// <param name="coordToMapPosFunc">function to transform coords to map position</param> public MarkersHandler(UserMarkerObject markerPrefab, Transform overlayContainer, int maxMarkers, Func <float, float, Vector3> coordToMapPosFunc) { this.maxMarkers = maxMarkers; this.coordToMapPosition = coordToMapPosFunc; exclusionArea = new ExclusionArea(); scenesFilter = new ScenesFilter(); availableMarkers = new List <UserPositionMarker>(maxMarkers); usedMarkers = new List <UserPositionMarker>(maxMarkers); for (int i = 0; i < maxMarkers; i++) { var marker = new UserPositionMarker(GameObject.Instantiate(markerPrefab, overlayContainer)); availableMarkers.Add(marker); marker.SetActive(false); } }