Ejemplo n.º 1
0
        private void SetMarker(UserPositionMarker marker, ParcelData parcelData)
        {
            marker.name = $"UsersPositionMarker({parcelData.coords.x},{parcelData.coords.y})";

            marker.localPosition = coordToMapPosition(
                parcelData.coords.x + Random.Range(-0.5f, 0.5f),
                parcelData.coords.y + Random.Range(-0.5f, 0.5f));

            marker.coords      = parcelData.coords;
            marker.realmServer = parcelData.realmServer;
            marker.realmLayer  = parcelData.realmLayer;

            marker.SetActive(!exclusionArea.Contains(parcelData.coords));
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }